diff --git a/test/unitTest/connectionManager/connectionManager.cpp b/test/unitTest/connectionManager/connectionManager.cpp index 0299d84e0c57a343e774a377851d67942dfc3683..66891180345e5e8f57c987535d9227bdeadd746c 100644 --- a/test/unitTest/connectionManager/connectionManager.cpp +++ b/test/unitTest/connectionManager/connectionManager.cpp @@ -1079,7 +1079,7 @@ ConnectionManagerTest::testCanSendBeacon() cv.notify_one(); }); // connectDevice is full async, so isConnecting will be true after a few ms. - CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&] { return aliceSocket && bobSocket; })); + CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&] { return aliceSocket && bobSocket && successfullyConnected; })); CPPUNIT_ASSERT(aliceSocket->canSendBeacon()); // Because onConnectionReady is true before version is sent, we can wait a bit @@ -1092,7 +1092,8 @@ ConnectionManagerTest::testCanSendBeacon() bobCanSendBeacon = bobSocket->canSendBeacon(); if (!bobCanSendBeacon || !aliceCanSendBeacon) std::this_thread::sleep_for(1s); - } while (not bobCanSendBeacon and not aliceCanSendBeacon and std::chrono::steady_clock::now() - start < 5s); + } while ((not bobCanSendBeacon or not aliceCanSendBeacon) + and std::chrono::steady_clock::now() - start < 5s); CPPUNIT_ASSERT(bobCanSendBeacon && aliceCanSendBeacon); }