Skip to content

Commit 5538519

Browse files
CBenoitCopilot
andcommitted
test(jetsocat): match CI feature flags in testsuite builds
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. Issue: DGW-350 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 78335e0 commit 5538519

2 files changed

Lines changed: 13 additions & 16 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: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ fn doctor_no_args_is_valid() {
299299
#[test]
300300
fn doctor_verify_chain_with_json_output() {
301301
// Chain checks that are expected to fail because the leaf certificate is expired.
302-
// On Windows, both the rustls and schannel backends run and detect the expiry.
302+
// On Windows, only the schannel backend runs (CI builds with native-tls, not rustls).
303303
let expected_chain_failures: &[&str] = if cfg!(windows) {
304-
&["rustls_check_chain", "schannel_check_chain"]
304+
&["schannel_check_chain"]
305305
} else {
306306
&["rustls_check_chain"]
307307
};
@@ -463,14 +463,10 @@ CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
463463
#[test]
464464
fn doctor_missing_san_and_eku() {
465465
// Checks that are expected to fail because the certificate is missing SAN and EKU.
466-
// The rustls end entity cert check also fails because rustls requires SAN for hostname verification.
467-
// The schannel end entity cert check succeeds because schannel falls back to CN matching.
466+
// On non-Windows, rustls runs: end entity cert check also fails because rustls requires SAN.
467+
// On Windows (native-tls/schannel only), schannel end entity cert check succeeds (CN fallback).
468468
let expected_failures: &[&str] = if cfg!(windows) {
469469
&[
470-
"rustls_check_end_entity_cert",
471-
"rustls_check_chain",
472-
"rustls_check_san_extension",
473-
"rustls_check_server_auth_eku",
474470
"schannel_check_chain",
475471
"schannel_check_san_extension",
476472
"schannel_check_server_auth_eku",
@@ -487,8 +483,6 @@ fn doctor_missing_san_and_eku() {
487483
// Checks expected to carry a warning about TlsVerifyStrict.
488484
let expected_warnings: &[&str] = if cfg!(windows) {
489485
&[
490-
"rustls_check_san_extension",
491-
"rustls_check_server_auth_eku",
492486
"schannel_check_san_extension",
493487
"schannel_check_server_auth_eku",
494488
]

0 commit comments

Comments
 (0)