| 1903 | |
| 1904 | #[tokio::test] |
| 1905 | async fn p2_cli_serve_only_one_process_allowed() -> Result<()> { |
| 1906 | let wasm = P2_CLI_SERVE_ECHO_ENV_COMPONENT; |
| 1907 | let server = WasmtimeServe::new(wasm, |cmd| { |
| 1908 | cmd.arg("-Scli"); |
| 1909 | })?; |
| 1910 | |
| 1911 | let err = WasmtimeServe::spawn( |
| 1912 | super::get_wasmtime_command()? |
| 1913 | .arg("serve") |
| 1914 | .arg("-Scli") |
| 1915 | .arg(format!("--addr={}", server.addr)) |
| 1916 | .arg(wasm), |
| 1917 | ) |
| 1918 | .err() |
| 1919 | .expect("server spawn should have failed but it succeeded"); |
| 1920 | drop(server); |
| 1921 | |
| 1922 | let err = format!("{err:?}"); |
| 1923 | println!("{err}"); |
| 1924 | assert!(err.contains("os error")); |
| 1925 | Ok(()) |
| 1926 | } |
| 1927 | |
| 1928 | // Technically this test is a little racy. This binds port 0 to acquire a |
| 1929 | // random port, issues a single request to this port, but then kills this |