From 2b25a2b2712032490ded42009cb7edb77ba2a163 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Tue, 3 Jan 2023 14:51:05 -0500
Subject: [PATCH] tests: fix bad condition for canSendBeacon

Change-Id: Iee8f14efab208e18eba1ab631a5f22e0ce0f34ad
---
 test/unitTest/connectionManager/connectionManager.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/unitTest/connectionManager/connectionManager.cpp b/test/unitTest/connectionManager/connectionManager.cpp
index 0299d84e0c..6689118034 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);
 }
-- 
GitLab