Skip to content

Commit a476c33

Browse files
committed
Ignore negotiated group difference in real world test
rustls has X25519MLKEM768 as the default key exchange group. OpenSSL depends on the version (3.5.0 also has X25519MLKEM768 by default) so this test can potentially fail for different environments.
1 parent 762f502 commit a476c33

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/runner.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ fn client_real_world() {
253253
.map(print_output)
254254
.unwrap();
255255

256+
let openssl_output = openssl_output
257+
.replace_stdout_line("negotiated group NID: ", "negotiated group NID: <varies>");
258+
let rustls_output = rustls_output
259+
.replace_stdout_line("negotiated group NID: ", "negotiated group NID: <varies>");
260+
256261
assert_eq!(openssl_output, rustls_output);
257262
}
258263

@@ -818,6 +823,25 @@ fn print_output(out: Output) -> PrettyOutput {
818823
#[derive(PartialEq)]
819824
struct PrettyOutput(Output);
820825

826+
impl PrettyOutput {
827+
fn replace_stdout_line(mut self, prefix: &str, replace_with: &str) -> Self {
828+
let mut out = String::new();
829+
for line in String::from_utf8(self.0.stdout)
830+
.expect("stdout should be valid utf8")
831+
.lines()
832+
{
833+
match line.starts_with(prefix) {
834+
true => out.push_str(replace_with),
835+
false => out.push_str(line),
836+
}
837+
out.push('\n');
838+
}
839+
840+
self.0.stdout = out.into_bytes();
841+
self
842+
}
843+
}
844+
821845
impl fmt::Debug for PrettyOutput {
822846
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
823847
f.debug_struct("Output")

0 commit comments

Comments
 (0)