Test suite timing tweaks

This commit is contained in:
Jason Rhinelander 2020-04-14 17:40:41 -03:00
parent 7de36da483
commit 3aa63c059d
3 changed files with 7 additions and 7 deletions

View File

@ -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 );
}

View File

@ -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<bool> 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);

View File

@ -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 );