Skip to content
Snippets Groups Projects
Commit 23057a30 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

unit tests: fix race condition

parent dbdd3f8f
Branches
Tags
No related merge requests found
...@@ -116,10 +116,7 @@ DhtProxyTester::testListen() { ...@@ -116,10 +116,7 @@ DhtProxyTester::testListen() {
// All values // All values
dht::Value secondVal {"You're a monster"}; dht::Value secondVal {"You're a monster"};
auto secondVal_data = secondVal.data; auto secondVal_data = secondVal.data;
nodePeer.put(key, std::move(secondVal), [&](bool) { nodePeer.put(key, std::move(secondVal));
done = true;
cv.notify_all();
});
cv.wait_for(lk, std::chrono::seconds(10), [&]{ return done; }); cv.wait_for(lk, std::chrono::seconds(10), [&]{ return done; });
// Here values should contains 3 values // Here values should contains 3 values
CPPUNIT_ASSERT_EQUAL(static_cast<int>(values.size()), 2); CPPUNIT_ASSERT_EQUAL(static_cast<int>(values.size()), 2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment