From b725c7fa5f937d10edb45b845bc0f9e96c33de67 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nicolas.pope@utu.fi>
Date: Tue, 10 May 2022 18:25:45 +0100
Subject: [PATCH] Another attempt with the net int tests

---
 test/net_integration.cpp | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/test/net_integration.cpp b/test/net_integration.cpp
index 3e3a476..1fa6d94 100644
--- a/test/net_integration.cpp
+++ b/test/net_integration.cpp
@@ -81,18 +81,13 @@ TEST_CASE("Listen and Connect", "[net]") {
 				// remote closes on first connection
 				disconnected_once = true;
 				p_listening->close(true);
-			} else {
-				// notify on second
 				cv.notify_one();
 			}
 			return true;
 		});
 
-		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));
+		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") {
@@ -112,17 +107,14 @@ TEST_CASE("Listen and Connect", "[net]") {
 				// disconnect on first connection
 				disconnected_once = true;
 				p_connecting->close(true);
-				LOG(INFO) << "disconnected";
-			}
-			else {
-				// notify on second
 				cv.notify_one();
 			}
+			
 			return true;
 		});
 
-		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));
 	}
 
 	ftl::protocol::reset();
-- 
GitLab