Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Paper over spurious failure in HTTP tests (#13794)

Alex Crichton500431bfcabf
diff --git a/crates/test-programs/src/bin/p2_http_outbound_request_invalid_version.rs b/crates/test-programs/src/bin/p2_http_outbound_request_invalid_version.rs
index e2009324ae..d17b79eb43 100644
--- a/crates/test-programs/src/bin/p2_http_outbound_request_invalid_version.rs
+++ b/crates/test-programs/src/bin/p2_http_outbound_request_invalid_version.rs
@@ -10,14 +10,22 @@ fn main() {
None,
Some(&[]),
None,
- None,
+ Some(1_000_000_000),
None,
);
- assert!(matches!(
- res.unwrap_err()
- .downcast::<ErrorCode>()
- .expect("expected a wasi-http ErrorCode"),
- ErrorCode::HttpProtocolError,
- ));
+ // The error seen during this test is mostly an `HttpProtocolError`, but
+ // depending on scheduling it's possible to get stuck in hyper right now
+ // where the server is indefinitely waiting on the client and the client
+ // times out. Accept both kinds of errors here, and note the explicit 1s
+ // timeout above to avoid this taking too long. in the timeout case.
+ let err = res.unwrap_err();
+ assert!(
+ matches!(
+ err.downcast_ref::<ErrorCode>()
+ .expect("expected a wasi-http ErrorCode"),
+ ErrorCode::HttpProtocolError | ErrorCode::ConnectionReadTimeout,
+ ),
+ "unexpected error: {err:?}"
+ );
}
diff --git a/crates/test-programs/src/bin/p3_http_outbound_request_invalid_version.rs b/crates/test-programs/src/bin/p3_http_outbound_request_invalid_version.rs
index 8562d52912..e8211580be 100644
--- a/crates/test-programs/src/bin/p3_http_outbound_request_invalid_version.rs
+++ b/crates/test-programs/src/bin/p3_http_outbound_request_invalid_version.rs
@@ -18,17 +18,25 @@ impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
None,
Some(&[]),
None,
- None,
+ Some(1_000_000_000),
None,
)
.await;
- assert!(matches!(
- res.unwrap_err()
- .downcast::<ErrorCode>()
- .expect("expected a wasi-http ErrorCode"),
- ErrorCode::HttpProtocolError,
- ));
+ // The error seen during this test is mostly an `HttpProtocolError`, but
+ // depending on scheduling it's possible to get stuck in hyper right now
+ // where the server is indefinitely waiting on the client and the client
+ // times out. Accept both kinds of errors here, and note the explicit 1s
+ // timeout above to avoid this taking too long. in the timeout case.
+ let err = res.unwrap_err();
+ assert!(
+ matches!(
+ err.downcast_ref::<ErrorCode>()
+ .expect("expected a wasi-http ErrorCode"),
+ ErrorCode::HttpProtocolError | ErrorCode::ConnectionReadTimeout,
+ ),
+ "unexpected error: {err:?}"
+ );
Ok(())
}
}