@@ -55,20 +55,30 @@ fn test_tls_invalid_certificate(_domain: &str, ip: IpAddress) -> Result<()> {
55
55
. context ( "tcp connect failed" ) ?;
56
56
57
57
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
+ }
64
68
Ok ( _) => panic ! ( "expecting server name mismatch" ) ,
65
69
}
66
70
}
67
71
68
72
fn try_live_endpoints ( test : impl Fn ( & str , IpAddress ) -> Result < ( ) > ) {
69
73
// since this is testing remote endpoints to ensure system cert store works
70
74
// 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
+ ] ;
72
82
73
83
let net = Network :: default ( ) ;
74
84
@@ -94,6 +104,8 @@ fn try_live_endpoints(test: impl Fn(&str, IpAddress) -> Result<()>) {
94
104
}
95
105
96
106
fn main ( ) {
107
+ println ! ( "sample app" ) ;
97
108
try_live_endpoints ( test_tls_sample_application) ;
109
+ println ! ( "invalid cert" ) ;
98
110
try_live_endpoints ( test_tls_invalid_certificate) ;
99
111
}
0 commit comments