tests: Fix data race in sysrepo-two-daemons test
This took me a while but there was a data race in
sysrepo_two-daemons_daemon code in the subscribe mode of the daemon.
The destructor of `std::map data` was being called while it was still
in the use by the OperCb.
Change-Id: I798ac4e98235879c7a1ac089fc092508422adcdc
diff --git a/tests/sysrepo_two-daemons_daemon.cpp b/tests/sysrepo_two-daemons_daemon.cpp
index d58928d..ebb8d4c 100644
--- a/tests/sysrepo_two-daemons_daemon.cpp
+++ b/tests/sysrepo_two-daemons_daemon.cpp
@@ -45,13 +45,11 @@
return 1;
}
+ std::map<std::string, std::string> data;
sysrepo::Connection srConn;
auto srSess = srConn.sessionStart();
-
std::optional<sysrepo::Subscription> srSub;
- std::map<std::string, std::string> data;
-
if (isDaemonSubscribe) {
data = {
{"/component[name='ne']/description", "This data was brought to you by process 2 (subscr)."},