Add WSS/TLS (self‑signed) with client cert pinning; auto ws→wss on --tls-ca/-t; add -p/-t flags; harden TLS test; fix clippy; update README. feat: WSS/TLS support (self‑signed + pinning), auto ws→wss when CA provided, new -p/-t flags; tests + clippy cleanup; docs updated. Add TLS: self‑signed certs on agent, client pin via --tls-ca/-t (auto‑upgrade to wss), CLI/tests/README updates, clippy fixes. 12 files changed Cargo.toml README.md Cargo.tomlsocktop_agent main.rssocktop_agent/src tls.rssocktop_agent/src cli_args.rssocktop_agent/tests Add Context... README.md
29 lines
927 B
Rust
29 lines
927 B
Rust
//! CLI arg parsing tests for socktop_agent (server)
|
|
use std::process::Command;
|
|
|
|
#[test]
|
|
fn test_help_and_port_short_long() {
|
|
// We verify port flags are accepted by ensuring the process starts (then we kill quickly).
|
|
// Use an unlikely port to avoid conflicts.
|
|
let exe = env!("CARGO_BIN_EXE_socktop_agent");
|
|
|
|
// TLS enabled with long --port
|
|
let mut child = Command::new(exe)
|
|
.args(["--enableSSL", "--port", "9555"])
|
|
.spawn()
|
|
.expect("spawn agent");
|
|
// Give it a moment to bind
|
|
std::thread::sleep(std::time::Duration::from_millis(150));
|
|
let _ = child.kill();
|
|
let _ = child.wait();
|
|
|
|
// TLS enabled with short -p
|
|
let mut child2 = Command::new(exe)
|
|
.args(["--enableSSL", "-p", "9556"])
|
|
.spawn()
|
|
.expect("spawn agent");
|
|
std::thread::sleep(std::time::Duration::from_millis(150));
|
|
let _ = child2.kill();
|
|
let _ = child2.wait();
|
|
}
|