test(gateway): cover visible iface alias help

The MVP test guide relies on --iface being both accepted and discoverable from
lanparty-gateway --help. The parser test already covered acceptance, but it did
not protect the rendered help text.

Render the Clap long help in a unit test and assert that the visible alias is
advertised. This keeps the handoff guide and binary self-documentation aligned.

Test Plan:
- cargo fmt --check
- cargo test -p lanparty-gateway iface_alias
- cargo run -p lanparty-gateway -- --help
- cargo test --workspace
- cargo clippy --workspace --all-targets -- -D warnings
- git diff --check
- git diff --cached --check

Refs: MVP gateway test handoff
This commit is contained in:
2026-05-22 07:07:06 +02:00
parent f851a27539
commit f229445c3d
+14
View File
@@ -1045,6 +1045,7 @@ mod tests {
use std::time::Duration;
use bytes::Bytes;
use clap::CommandFactory;
use lanparty_net::DEFAULT_RELAY_PORT;
use quinn::{ServerConfig, TransportConfig, crypto::rustls::QuicServerConfig};
use rustls::pki_types::{PrivateKeyDer, PrivatePkcs8KeyDer};
@@ -1121,6 +1122,19 @@ mod tests {
assert_eq!(args.interface, "eth0");
}
#[test]
fn shows_iface_alias_in_help() {
let mut command = GatewayArgs::command();
let mut help = Vec::new();
command.write_long_help(&mut help).unwrap();
let help = String::from_utf8(help).unwrap();
assert!(
help.contains("[aliases: --iface]"),
"gateway help should advertise --iface alias:\n{help}"
);
}
#[tokio::test]
async fn connects_to_relay_control_stream_as_gateway() {
let (server_config, certificate) = test_server_config();