test: reproduce #270 (solvecraft-cli mcp --connect without a listening app gives no hint)
This commit is contained in:
1 parent
bf60758244
commit
56a2ed1e4f
1 file changed
+18
@@ -0,0 +1,18 @@
|
|||||||
|
//! `mcp --connect` to a port where no app listens tells the user how to start one (#270).
|
||||||
|
|
||||||
|
use std::net::TcpListener;
|
||||||
|
use std::process::{Command, Stdio};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn mcp_connect_without_a_listening_app_names_the_control_flag() {
|
||||||
|
// A port that was free a moment ago: nothing listens on it.
|
||||||
|
let port = TcpListener::bind("127.0.0.1:0").unwrap().local_addr().unwrap().port();
|
||||||
|
let output = Command::new(env!("CARGO_BIN_EXE_solvecraft-cli"))
|
||||||
|
.args(["mcp", "--connect", &format!("127.0.0.1:{port}")])
|
||||||
|
.stdin(Stdio::null())
|
||||||
|
.output()
|
||||||
|
.unwrap();
|
||||||
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||||
|
assert!(!output.status.success(), "{stderr}");
|
||||||
|
assert!(stderr.contains("--control"), "say how to start the app with a control port: {stderr}");
|
||||||
|
}
|
||||||
Reference in new issue
Block a user