Skip to content

Commit 9e8690a

Browse files
committed
Fix test_server_mode to explicitly bind to localhost
Previously this test passed port-only (e.g., '19876') which now binds to 0.0.0.0 (all interfaces) per Go convention. The test expects localhost binding, so explicitly specify '127.0.0.1:PORT' format.
1 parent 81f4030 commit 9e8690a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/weak_integration.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ fn start_server(http_port: u16, https_port: u16) -> Result<std::process::Child,
180180
.arg("--js")
181181
.arg("true")
182182
.arg("-vv")
183-
.env("HTTPJAIL_HTTP_BIND", http_port.to_string())
184-
.env("HTTPJAIL_HTTPS_BIND", https_port.to_string())
183+
.env("HTTPJAIL_HTTP_BIND", format!("127.0.0.1:{}", http_port))
184+
.env("HTTPJAIL_HTTPS_BIND", format!("127.0.0.1:{}", https_port))
185185
.env("HTTPJAIL_SKIP_KEYCHAIN_INSTALL", "1") // Skip automatic keychain installation during tests
186186
.stdout(Stdio::null())
187187
.stderr(Stdio::null());
@@ -336,7 +336,10 @@ fn test_server_bind_defaults() {
336336
fn test_server_bind_port_only() {
337337
// Port-only should bind to all interfaces (0.0.0.0)
338338
let (mut server, port) = start_server_with_bind("19882", "19883");
339-
assert_eq!(port, 19882, "Server should bind to specified port on all interfaces");
339+
assert_eq!(
340+
port, 19882,
341+
"Server should bind to specified port on all interfaces"
342+
);
340343
server.kill().ok();
341344
}
342345

0 commit comments

Comments
 (0)