Skip to content

Commit 5592b13

Browse files
committed
ci: add verbose logging to failing tests for debugging
- Add -vv flags to httpjail commands in failing tests - Add detailed stderr/stdout output for all failing tests - Truncate long stderr output to first 2000-3000 chars - Print exit codes for better debugging
1 parent f1cb8b6 commit 5592b13

1 file changed

Lines changed: 41 additions & 7 deletions

File tree

tests/system_integration.rs

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,32 @@ pub fn test_jail_denies_non_matching_requests<P: JailTestPlatform>() {
102102
P::require_privileges();
103103

104104
let mut cmd = httpjail_cmd();
105-
cmd.arg("-r").arg("allow: ifconfig\\.me").arg("--");
105+
cmd.arg("-v")
106+
.arg("-v") // Add verbose logging
107+
.arg("-r")
108+
.arg("allow: ifconfig\\.me")
109+
.arg("--");
106110
curl_http_status_args(&mut cmd, "http://example.com");
107111

108112
let output = cmd.output().expect("Failed to execute httpjail");
109113

110114
let stdout = String::from_utf8_lossy(&output.stdout);
115+
let stderr = String::from_utf8_lossy(&output.stderr);
116+
117+
// Always print debug info for this failing test
118+
eprintln!(
119+
"[{}] test_jail_denies_non_matching_requests:",
120+
P::platform_name()
121+
);
122+
eprintln!(" Exit code: {:?}", output.status.code());
123+
eprintln!(" Stdout: {}", stdout);
124+
if !stderr.is_empty() {
125+
eprintln!(
126+
" Stderr (first 2000 chars): {}",
127+
&stderr.chars().take(2000).collect::<String>()
128+
);
129+
}
130+
111131
// Should get 403 Forbidden from our proxy
112132
assert_eq!(stdout.trim(), "403", "Request should be denied");
113133
// curl itself should succeed (it got a response)
@@ -252,7 +272,9 @@ pub fn test_native_jail_blocks_https<P: JailTestPlatform>() {
252272

253273
// Test that HTTPS requests to denied domains are blocked
254274
let mut cmd = httpjail_cmd();
255-
cmd.arg("-r")
275+
cmd.arg("-v")
276+
.arg("-v") // Add verbose logging
277+
.arg("-r")
256278
.arg("allow: ifconfig\\.me")
257279
.arg("-r")
258280
.arg("deny: example\\.com")
@@ -265,9 +287,14 @@ pub fn test_native_jail_blocks_https<P: JailTestPlatform>() {
265287
let stdout = String::from_utf8_lossy(&output.stdout);
266288

267289
eprintln!(
268-
"[{}] HTTPS denied test stderr: {}",
290+
"[{}] test_native_jail_blocks_https exit code: {:?}",
269291
P::platform_name(),
270-
stderr
292+
output.status.code()
293+
);
294+
eprintln!(
295+
"[{}] HTTPS denied test stderr (first 3000 chars): {}",
296+
P::platform_name(),
297+
&stderr.chars().take(3000).collect::<String>()
271298
);
272299
eprintln!(
273300
"[{}] HTTPS denied test stdout: {}",
@@ -409,7 +436,9 @@ pub fn test_jail_https_connect_denied<P: JailTestPlatform>() {
409436

410437
// Test that HTTPS requests to denied domains are blocked
411438
let mut cmd = httpjail_cmd();
412-
cmd.arg("-r")
439+
cmd.arg("-v")
440+
.arg("-v") // Add verbose logging
441+
.arg("-r")
413442
.arg("allow: ifconfig\\.me")
414443
.arg("-r")
415444
.arg("deny: example\\.com")
@@ -422,9 +451,14 @@ pub fn test_jail_https_connect_denied<P: JailTestPlatform>() {
422451
let stdout = String::from_utf8_lossy(&output.stdout);
423452

424453
eprintln!(
425-
"[{}] HTTPS denied test stderr: {}",
454+
"[{}] HTTPS denied test exit code: {:?}",
426455
P::platform_name(),
427-
stderr
456+
output.status.code()
457+
);
458+
eprintln!(
459+
"[{}] HTTPS denied test stderr (first 3000 chars): {}",
460+
P::platform_name(),
461+
&stderr.chars().take(3000).collect::<String>()
428462
);
429463
eprintln!(
430464
"[{}] HTTPS denied test stdout: {}",

0 commit comments

Comments
 (0)