| 2027 | |
| 2028 | #[tokio::test] |
| 2029 | async fn p2_cli_serve_with_print_no_prefix() -> Result<()> { |
| 2030 | let server = WasmtimeServe::new(P2_CLI_SERVE_WITH_PRINT_COMPONENT, |cmd| { |
| 2031 | cmd.arg("-Scli"); |
| 2032 | cmd.arg("--no-logging-prefix"); |
| 2033 | })?; |
| 2034 | |
| 2035 | for _ in 0..2 { |
| 2036 | let resp = server |
| 2037 | .send_request( |
| 2038 | hyper::Request::builder() |
| 2039 | .uri("http://localhost/") |
| 2040 | .body(String::new()) |
| 2041 | .context("failed to make request")?, |
| 2042 | ) |
| 2043 | .await?; |
| 2044 | assert!(resp.status().is_success()); |
| 2045 | } |
| 2046 | |
| 2047 | let (out, err) = server.finish()?; |
| 2048 | assert_eq!( |
| 2049 | out, |
| 2050 | "\ |
| 2051 | this is half a print to stdout |
| 2052 | \n\ |
| 2053 | after empty |
| 2054 | this is half a print to stdout |
| 2055 | \n\ |
| 2056 | after empty |
| 2057 | " |
| 2058 | ); |
| 2059 | assert!( |
| 2060 | err.contains( |
| 2061 | "\ |
| 2062 | this is half a print to stderr |
| 2063 | \n\ |
| 2064 | after empty |
| 2065 | start a print 1234 |
| 2066 | this is half a print to stderr |
| 2067 | \n\ |
| 2068 | after empty |
| 2069 | start a print 1234 |
| 2070 | " |
| 2071 | ), |
| 2072 | "bad stderr {err}", |
| 2073 | ); |
| 2074 | |
| 2075 | Ok(()) |
| 2076 | } |
| 2077 | |
| 2078 | #[tokio::test] |
| 2079 | async fn p2_cli_serve_authority_and_scheme() -> Result<()> { |