Skip to content

Commit d21e276

Browse files
authored
test(jetsocat): match CI feature flags in testsuite builds (#1720)
Build jetsocat with native-tls instead of rustls on Windows in the testsuite, matching the CI configuration. Update test expectations to reflect that only the schannel backend runs on Windows.
1 parent 9619444 commit d21e276

2 files changed

Lines changed: 14 additions & 20 deletions

File tree

testsuite/src/cli.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
use std::sync::LazyLock;
44

55
static JETSOCAT_BIN_PATH: LazyLock<std::path::PathBuf> = LazyLock::new(|| {
6-
escargot::CargoBuild::new()
6+
let mut build = escargot::CargoBuild::new()
77
.manifest_path("../jetsocat/Cargo.toml")
88
.bin("jetsocat")
99
.current_release()
10-
.current_target()
11-
.run()
12-
.expect("build jetsocat")
13-
.path()
14-
.to_path_buf()
10+
.current_target();
11+
12+
// Match CI: on Windows, build with native-tls instead of the default rustls.
13+
if cfg!(windows) {
14+
build = build.no_default_features().features("native-tls detect-proxy");
15+
}
16+
17+
build.run().expect("build jetsocat").path().to_path_buf()
1518
});
1619

1720
pub fn jetsocat_assert_cmd() -> assert_cmd::Command {

testsuite/tests/cli/jetsocat.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ fn doctor_no_args_is_valid() {
316316
#[test]
317317
fn doctor_verify_chain_with_json_output() {
318318
// Chain checks that are expected to fail because the leaf certificate is expired.
319-
// On Windows, both the rustls and schannel backends run and detect the expiry.
319+
// On Windows, only the schannel backend runs (CI builds with native-tls, not rustls).
320320
let expected_chain_failures: &[&str] = if cfg!(windows) {
321-
&["rustls_check_chain", "schannel_check_chain"]
321+
&["schannel_check_chain"]
322322
} else {
323323
&["rustls_check_chain"]
324324
};
@@ -480,14 +480,10 @@ CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
480480
#[test]
481481
fn doctor_missing_san_and_eku() {
482482
// Checks that are expected to fail because the certificate is missing SAN and EKU.
483-
// The rustls end entity cert check also fails because rustls requires SAN for hostname verification.
484-
// The schannel end entity cert check succeeds because schannel falls back to CN matching.
483+
// On non-Windows, rustls runs: end entity cert check also fails because rustls requires SAN.
484+
// On Windows (native-tls/schannel only), schannel end entity cert check succeeds (CN fallback).
485485
let expected_failures: &[&str] = if cfg!(windows) {
486486
&[
487-
"rustls_check_end_entity_cert",
488-
"rustls_check_chain",
489-
"rustls_check_san_extension",
490-
"rustls_check_server_auth_eku",
491487
"schannel_check_chain",
492488
"schannel_check_san_extension",
493489
"schannel_check_server_auth_eku",
@@ -503,12 +499,7 @@ fn doctor_missing_san_and_eku() {
503499

504500
// Checks expected to carry a warning about TlsVerifyStrict.
505501
let expected_warnings: &[&str] = if cfg!(windows) {
506-
&[
507-
"rustls_check_san_extension",
508-
"rustls_check_server_auth_eku",
509-
"schannel_check_san_extension",
510-
"schannel_check_server_auth_eku",
511-
]
502+
&["schannel_check_san_extension", "schannel_check_server_auth_eku"]
512503
} else {
513504
&["rustls_check_san_extension", "rustls_check_server_auth_eku"]
514505
};

0 commit comments

Comments
 (0)