diff options
| author | Joakim Hulthe <joakim@hulthe.net> | 2024-03-27 14:00:27 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-04-08 11:00:59 +0200 |
| commit | daa08962c88dbf36c674611fb9a9de8d53b9478b (patch) | |
| tree | 47e151941786294254d83fe7c0f523f5979b09b5 /test/test-runner | |
| parent | 08c647be341136c1ca91d8ee6b118d36ea9cb9de (diff) | |
| download | mullvadvpn-daa08962c88dbf36c674611fb9a9de8d53b9478b.tar.xz mullvadvpn-daa08962c88dbf36c674611fb9a9de8d53b9478b.zip | |
Add timeout to tester geoip rcp call
Diffstat (limited to 'test/test-runner')
| -rw-r--r-- | test/test-runner/src/main.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/test-runner/src/main.rs b/test/test-runner/src/main.rs index d864968bbe..8399e118d3 100644 --- a/test/test-runner/src/main.rs +++ b/test/test-runner/src/main.rs @@ -6,7 +6,7 @@ use std::{ path::{Path, PathBuf}, process::Stdio, sync::Arc, - time::Duration, + time::{Duration, SystemTime}, }; use util::OnDrop; @@ -171,10 +171,18 @@ impl Service for TestServer { async fn geoip_lookup( self, - _: context::Context, + ctx: context::Context, mullvad_host: String, ) -> Result<test_rpc::AmIMullvad, test_rpc::Error> { - test_rpc::net::geoip_lookup(mullvad_host).await + let timeout = ctx + .deadline + .duration_since(SystemTime::now()) + .ok() + // account for some time to send the RPC response + .and_then(|d| d.checked_sub(Duration::from_millis(500))) + .unwrap_or_default(); + + test_rpc::net::geoip_lookup(mullvad_host, timeout).await } async fn resolve_hostname( |
