diff --git a/tests/test_commands.cpp b/tests/test_commands.cpp index e185cdc..d6f63d3 100644 --- a/tests/test_commands.cpp +++ b/tests/test_commands.cpp @@ -125,7 +125,7 @@ TEST_CASE("outgoing auth level", "[commands][auth]") { client.send(admin_c, "public.reflect", "admin.hi"); client.send(basic_c, "public.reflect", "basic.hi"); - wait_for([&] { return public_hi == 2; }); + wait_for([&] { return basic_hi == 2; }); { auto lock = catch_lock(); REQUIRE( admin_hi == 3 ); @@ -322,7 +322,7 @@ TEST_CASE("send failure callbacks", "[commands][queue_full]") { } { auto lock = catch_lock(); - REQUIRE( i <= 4 ); // should be not too slow + REQUIRE( i < 20 ); // should be not too slow // We have two buffers here: 1000 on the receiver, and 1000 on the client, which means we // should be able to get 2000 out before we hit HWM. We should only have been sent 501 so // far (the "HELLO" handshake + 500 "y.y" messages). @@ -347,14 +347,14 @@ TEST_CASE("send failure callbacks", "[commands][queue_full]") { } } - for (i = 0; i < 20; i++) { + for (i = 0; i < 100; i++) { if (send_attempts.load() >= expected_attempts) break; std::this_thread::sleep_for(10ms); } { auto lock = catch_lock(); - REQUIRE( i < 20 ); + REQUIRE( i < 100 ); REQUIRE( send_attempts.load() == expected_attempts ); REQUIRE( send_failures.load() > 0 ); } diff --git a/tests/test_connect.cpp b/tests/test_connect.cpp index b0c5fdf..2c670ec 100644 --- a/tests/test_connect.cpp +++ b/tests/test_connect.cpp @@ -69,7 +69,7 @@ TEST_CASE("self-connection SN optimization", "[connect][self]") { return AuthLevel::none; }); sn.add_category("a", Access{AuthLevel::none}); - bool invoked = false; + std::atomic invoked{false}; sn.add_command("a", "b", [&](const Message& m) { invoked = true; auto lock = catch_lock(); @@ -82,7 +82,7 @@ TEST_CASE("self-connection SN optimization", "[connect][self]") { sn.start(); sn.send(pubkey, "a.b", "my data"); - reply_sleep(); + wait_for_conn(invoked); { auto lock = catch_lock(); REQUIRE(invoked); diff --git a/tests/test_requests.cpp b/tests/test_requests.cpp index 46b2dae..6f3da70 100644 --- a/tests/test_requests.cpp +++ b/tests/test_requests.cpp @@ -182,7 +182,7 @@ TEST_CASE("request timeouts", "[requests][timeout]") { lokimq::send_option::request_timeout{100ms} ); - std::this_thread::sleep_for(30ms); + std::this_thread::sleep_for(40ms); REQUIRE( got_triggered ); REQUIRE_FALSE( got_triggered2 ); REQUIRE_FALSE( success );