From ccb3d36fae1def7ebbbd3acc383ed57d5b2bb833 Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Mon, 17 Oct 2022 08:38:03 +0200 Subject: [PATCH] Complete previous test --- rust/sea_battle_backend/src/test/bot_random_play.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust/sea_battle_backend/src/test/bot_random_play.rs b/rust/sea_battle_backend/src/test/bot_random_play.rs index 03beaab..c090ae3 100644 --- a/rust/sea_battle_backend/src/test/bot_random_play.rs +++ b/rust/sea_battle_backend/src/test/bot_random_play.rs @@ -10,6 +10,7 @@ use crate::test::bot_client::ClientEndResult; use crate::test::play_utils::check_no_replay_on_hit; use crate::test::TestPort; use crate::utils::network_utils::wait_for_port; +use crate::utils::time_utils::time; #[tokio::test] async fn invalid_port() { @@ -214,6 +215,8 @@ async fn check_fire_time_out() { task::spawn_local(start_server(Args::for_test(TestPort::RandomCheckTimeout))); wait_for_port(TestPort::RandomCheckTimeout.port()).await; + let start = time(); + let mut did_skip_one = false; let res = bot_client::BotClient::new(TestPort::RandomCheckTimeout.as_url()) .with_rules( @@ -228,7 +231,10 @@ async fn check_fire_time_out() { .run_client() .await .unwrap(); + assert!(matches!(res, ClientEndResult::Finished { .. })); + + assert!(time() - start >= MIN_STRIKE_TIMEOUT); }) .await; }