Skip to content

fix(test): add scope guard for logger sink cleanup in dynamic index tests - #471

Open
rfsaliev wants to merge 1 commit into
mainfrom
rfsaliev/fix-log-sink-in-test
Open

rfsaliev wants to merge 1 commit into
mainfrom
rfsaliev/fix-log-sink-in-test

Conversation

@rfsaliev

Copy link
Copy Markdown
Member

This pull request makes improvements to logging resource management in the test suite for the Vamana dynamic index. The main change is the introduction of a scope guard to ensure that a locally-captured logging sink is properly removed before the associated vector goes out of scope, preventing potential resource leaks or invalid accesses.

Resource management improvements:

  • Added #include "svs/lib/scopeguard.h" to dynamic_index_2.cpp to enable use of scope guards for automatic resource cleanup.
  • In both the "Testing Graph Index" and "Dynamic MutableVamanaIndex Per-Index Logging Test" test cases in dynamic_index_2.cpp, wrapped the addition of global_callback_sink to the logger with a scope guard (svs::lib::make_scope_guard) to ensure the sink is removed from the logger's sinks vector when the test scope ends. [1] [2]

This branch has not been deployed

No deployments
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.

1 participant