From a301bc836b33838bb8149bbdcdfeb4496ef4bdb8 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nicolas.pope@utu.fi>
Date: Tue, 10 May 2022 18:01:59 +0100
Subject: [PATCH] Fix cv in net int test

---
 test/net_integration.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/net_integration.cpp b/test/net_integration.cpp
index c83f8cb..3e3a476 100644
--- a/test/net_integration.cpp
+++ b/test/net_integration.cpp
@@ -88,8 +88,11 @@ TEST_CASE("Listen and Connect", "[net]") {
 			return true;
 		});
 
-		REQUIRE(cv.wait_for(lk, std::chrono::seconds(5)) == std::cv_status::no_timeout);
-		REQUIRE(p_connecting->waitConnection(5));
+		bool res = cv.wait_for(lk, std::chrono::seconds(5), [p_connecting]() { return p_connecting->isConnected(); });
+		REQUIRE( res );
+
+		//REQUIRE(cv.wait_for(lk, std::chrono::seconds(5)) == std::cv_status::no_timeout);
+		//REQUIRE(p_connecting->waitConnection(5));
 	}
 
 	SECTION("automatic reconnect from originating connection") {
@@ -118,8 +121,8 @@ TEST_CASE("Listen and Connect", "[net]") {
 			return true;
 		});
 
-		REQUIRE(cv.wait_for(lk, std::chrono::seconds(5)) == std::cv_status::no_timeout);
-		REQUIRE(p_connecting->isConnected());
+		bool res = cv.wait_for(lk, std::chrono::seconds(5), [p_connecting]() { return p_connecting->isConnected(); });
+		REQUIRE( res );
 	}
 
 	ftl::protocol::reset();
-- 
GitLab