Skip to content

Commit cc15060

Browse files
committed
Add more domains to tls_sample_application (#11265)
Both our current domains failed in https://github.com/bytecodealliance/wasmtime/actions/runs/16349123310/job/46190913918 so add a few more.
1 parent 62c7e83 commit cc15060

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

crates/test-programs/src/bin/tls_sample_application.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,30 @@ fn test_tls_invalid_certificate(_domain: &str, ip: IpAddress) -> Result<()> {
5555
.context("tcp connect failed")?;
5656

5757
match ClientHandshake::new(BAD_DOMAIN, tcp_input, tcp_output).blocking_finish() {
58-
// We're expecting an error regarding the "certificate" is some form or
59-
// another. When we add more TLS backends this naive
60-
// check will likely need to be revisited/expanded:
61-
Err(e) if e.to_debug_string().contains("certificate") => Ok(()),
62-
63-
Err(e) => Err(e.into()),
58+
Err(e) => {
59+
let debug_string = e.to_debug_string();
60+
// We're expecting an error regarding certificates in some form or
61+
// another. When we add more TLS backends this naive check will
62+
// likely need to be revisited/expanded:
63+
if debug_string.contains("certificate") || debug_string.contains("HandshakeFailure") {
64+
return Ok(());
65+
}
66+
Err(e.into())
67+
}
6468
Ok(_) => panic!("expecting server name mismatch"),
6569
}
6670
}
6771

6872
fn try_live_endpoints(test: impl Fn(&str, IpAddress) -> Result<()>) {
6973
// since this is testing remote endpoints to ensure system cert store works
7074
// the test uses a couple different endpoints to reduce the number of flakes
71-
const DOMAINS: &'static [&'static str] = &["example.com", "api.github.com"];
75+
const DOMAINS: &'static [&'static str] = &[
76+
"example.com",
77+
"api.github.com",
78+
"docs.wasmtime.dev",
79+
"bytecodealliance.org",
80+
"www.rust-lang.org",
81+
];
7282

7383
let net = Network::default();
7484

@@ -94,6 +104,8 @@ fn try_live_endpoints(test: impl Fn(&str, IpAddress) -> Result<()>) {
94104
}
95105

96106
fn main() {
107+
println!("sample app");
97108
try_live_endpoints(test_tls_sample_application);
109+
println!("invalid cert");
98110
try_live_endpoints(test_tls_invalid_certificate);
99111
}

crates/wasi-tls/tests/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ async fn run_test(path: &str) -> Result<()> {
2727
let ctx = Ctx {
2828
table: ResourceTable::new(),
2929
wasi_ctx: WasiCtxBuilder::new()
30+
.inherit_stdout()
3031
.inherit_stderr()
3132
.inherit_network()
3233
.allow_ip_name_lookup(true)

0 commit comments

Comments
 (0)