mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
tests: wait for put before performing get
This commit is contained in:
1 parent
56773baa98
commit
c7604fbb8d
1 file changed
+5
-1
@@ -50,7 +50,11 @@ DhtRunnerTester::testGetPut() {
|
||||
auto key = dht::InfoHash::get("123");
|
||||
dht::Value val {"hey"};
|
||||
auto val_data = val.data;
|
||||
node1.put(key, std::move(val));
|
||||
std::promise<bool> p;
|
||||
node1.put(key, std::move(val), [&](bool ok){
|
||||
p.set_value(ok);
|
||||
});
|
||||
CPPUNIT_ASSERT(p.get_future().get());
|
||||
auto vals = node2.get(key).get();
|
||||
CPPUNIT_ASSERT(not vals.empty());
|
||||
CPPUNIT_ASSERT(vals.front()->data == val_data);
|
||||
|
||||
Reference in new issue
Block a user