From 17353cf8e183de431c3c1b51cf826cda2700708e Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Mon, 19 Aug 2024 13:19:56 +0100 Subject: [PATCH] Timeout configurable --- crates/librqbit/src/tests/e2e.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/librqbit/src/tests/e2e.rs b/crates/librqbit/src/tests/e2e.rs index 3edf7ea..75147bd 100644 --- a/crates/librqbit/src/tests/e2e.rs +++ b/crates/librqbit/src/tests/e2e.rs @@ -20,12 +20,16 @@ use crate::{ AddTorrentOptions, AddTorrentResponse, Session, SessionOptions, }; -const TIMEOUT_SECS: u64 = 180; - #[tokio::test(flavor = "multi_thread", worker_threads = 64)] async fn test_e2e_download() { - tokio::time::timeout(Duration::from_secs(TIMEOUT_SECS), _test_e2e_download()) + let timeout = std::env::var("E2E_TIMEOUT") + .ok() + .and_then(|v| v.parse().ok()) + .unwrap_or(180); + + tokio::time::timeout(Duration::from_secs(timeout), _test_e2e_download()) .await + .context("test_e2e_download timed out") .unwrap() }