From 3b293c8edcc67d6e1c3ba4d16b91a8e1783ee0c4 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Thu, 4 Apr 2024 11:33:20 -0400 Subject: [PATCH] test: add client -> example.com test 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. --- rustls-libssl/tests/runner.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/rustls-libssl/tests/runner.rs b/rustls-libssl/tests/runner.rs index e920677..f316363 100644 --- a/rustls-libssl/tests/runner.rs +++ b/rustls-libssl/tests/runner.rs @@ -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("target/client") + .env("LD_LIBRARY_PATH", "") + .env("NO_ECHO", "1") + .args(&["example.com", "443", "default"]) + .stdout(Stdio::piped()) + .output() + .map(print_output) + .unwrap(); + + let rustls_output = Command::new("target/client") + .env("NO_ECHO", "1") + .args(&["example.com", "443", "default"]) + .stdout(Stdio::piped()) + .output() + .map(print_output) + .unwrap(); + + assert_eq!(openssl_output, rustls_output); +} + #[test] #[ignore] fn constants() {