Skip to content

fix(test) Add scope guard for logger sink cleanup in index tests - #488

Merged
rfsaliev merged 2 commits into
mainfrom
rfsaliev/fix-log-sink-in-test
Nov 25, 2026
Merged

rfsaliev merged 2 commits into
mainfrom
rfsaliev/fix-log-sink-in-test

Conversation

@rfsaliev

Copy link
Copy Markdown
Member

This pull request improves the reliability of logging tests across several index-related test files by ensuring that custom logging sinks are properly removed after each test case. This is achieved by introducing a scope guard to automatically clean up the logging sinks, preventing potential issues with dangling pointers or memory leaks. Additionally, necessary includes for <algorithm> and the new svs/lib/scopeguard.h utility are added to support these changes.

Test reliability and logging cleanup:

  • Added a scope guard (svs::lib::make_scope_guard) in all logging-related test cases to ensure that the custom logging sink (global_callback_sink) is removed from the logger's sink list when the test scope ends, preventing resource leaks and potential test interference. [1] [2] [3] [4] [5] [6]

Dependency and include updates:

  • Included svs/lib/scopeguard.h and <algorithm> where necessary to support the new scope guard functionality and the use of std::remove for sink removal. [1] [2] F51d32a0L17R17, [3] [4] [5] [6] F51d32a0L17R17, [7]

These changes collectively make the logging tests more robust and maintainable by ensuring proper cleanup and preventing side effects between tests.

@rfsaliev
rfsaliev merged commit 0550e14 into main Nov 25, 2026
20 of 21 checks passed
@rfsaliev
rfsaliev deleted the rfsaliev/fix-log-sink-in-test branch November 25, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants