The following diff should be applied to ensure that the connect_timeout variable is correctly passed into the handle function.
This code was removed in #8085 (comment) due to a failure on Windows MinGW x86_64.
diff --git a/crates/test-programs/src/bin/http_outbound_request_timeout.rs b/crates/test-programs/src/bin/http_outbound_request_timeout.rs
index 8bd7601..198288e 100644
--- a/crates/test-programs/src/bin/http_outbound_request_timeout.rs
+++ b/crates/test-programs/src/bin/http_outbound_request_timeout.rs
@@ -1,13 +1,12 @@
use anyhow::Context;
use std::net::SocketAddr;
-use std::time::Duration;
+use std::time::{Duration, Instant};
use test_programs::wasi::http::types::{ErrorCode, Method, Scheme};
fn main() {
// This address inside the TEST-NET-3 address block is expected to time out.
let addr = SocketAddr::from(([203, 0, 113, 12], 80)).to_string();
let timeout = Duration::from_millis(200);
+ let start = Instant::now();
let connect_timeout: Option<u64> = Some(timeout.as_nanos() as u64);
let res = test_programs::http::request(
Method::Get,
@@ -30,9 +29,4 @@ fn main() {
),
"expected connection timeout"
);
+
+ let actual = start.elapsed();
+ let tolerance = Duration::from_millis(100);
+ let upper_bound = timeout + tolerance;
+ assert!(actual < upper_bound);
}
The following diff should be applied to ensure that the
connect_timeoutvariable is correctly passed into thehandlefunction.This code was removed in #8085 (comment) due to a failure on Windows MinGW x86_64.