Skip to content

Commit

Permalink
test: add client -> example.com test
Browse files Browse the repository at this point in the history
This commit adds a unit test that uses the client test binary to
connect to https://example.com, validating the presented certificate
chain using the system default CA bundle. We do this with `NO_ECHO=1` to
avoid trying to write a non-HTTP request and asserting on an echoed
response.
  • Loading branch information
cpu committed Apr 5, 2024
1 parent 150435f commit 5859eba
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions rustls-libssl/tests/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,29 @@ fn client() {
assert_eq!(openssl_secure_output, rustls_secure_output);
}

#[test]
#[ignore]
fn client_real_world() {
let openssl_output = Command::new("tests/maybe-valgrind.sh")
.env("LD_LIBRARY_PATH", "")
.env("NO_ECHO", "1")
.args(&["target/client", "example.com", "443", "default"])
.stdout(Stdio::piped())
.output()
.map(print_output)
.unwrap();

let rustls_output = Command::new("tests/maybe-valgrind.sh")
.env("NO_ECHO", "1")
.args(&["target/client", "example.com", "443", "default"])
.stdout(Stdio::piped())
.output()
.map(print_output)
.unwrap();

assert_eq!(openssl_output, rustls_output);
}

#[test]
#[ignore]
fn constants() {
Expand Down

0 comments on commit 5859eba

Please sign in to comment.