test: fix sporadic failures in testCacheRequestFromClient

Change-Id: I5139977d9d1fe49c9773ab3ad4a069ecf67ef637
This commit is contained in:
Sébastien Blin
2024-01-10 09:52:02 -05:00
parent 340e4d0d6d
commit 7fd1bac6c5

View File

@ -945,7 +945,16 @@ ConversationRequestTest::testCacheRequestFromClient()
CPPUNIT_ASSERT(bobAccount->getTrustRequests().size() == 1);
libjami::acceptConversationRequest(bobId, aliceData.conversationId);
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return !bobData.conversationId.empty(); }));
CPPUNIT_ASSERT(!std::filesystem::is_regular_file(cachedPath));
// cachedPath is removed on confirmation (from the DHT), so this can take a few secs to come
auto removed = false;
for (int i = 0; i <= 10; ++i) {
if (!std::filesystem::is_regular_file(cachedPath)) {
removed = true;
break;
}
std::this_thread::sleep_for(1s);
}
CPPUNIT_ASSERT(removed);
}
void