diff --git a/src/async/proto/mod.rs b/src/async/proto/mod.rs index 083065af..4ec12dd1 100644 --- a/src/async/proto/mod.rs +++ b/src/async/proto/mod.rs @@ -177,48 +177,3 @@ impl<'a, S: AsyncBufReadExt + AsyncWriteExt + Unpin + Send> ReadToken<'a, S> { single::read_json(&mut self.0.stream).await } } -#[cfg(test)] -mod test { - use super::{single, AsyncClient}; - use crate::proto::{ - get_env_url, host_from_url, url_parse, ClientOptions, Hello, Push, - EXPECTED_PROTOCOL_VERSION, - }; - use crate::JobBuilder; - use tokio::io::BufStream; - use tokio::net::TcpStream; - - async fn get_connected_client() -> Option>> { - if std::env::var_os("FAKTORY_URL").is_none() { - return None; - } - let url = url_parse(&get_env_url()).unwrap(); - let host = host_from_url(&url); - let stream = BufStream::new(TcpStream::connect(host).await.unwrap()); - let opts = ClientOptions::default(); - Some(AsyncClient { stream, opts }) - } - - #[tokio::test(flavor = "multi_thread")] - async fn test_client_runs_handshake_with_server_after_connect() { - if let Some(mut c) = get_connected_client().await { - let hi = single::read_hi(&mut c.stream).await.unwrap(); - assert_eq!(hi.version, EXPECTED_PROTOCOL_VERSION); - let hello = Hello::default(); - single::write_command_and_await_ok(&mut c.stream, &hello) - .await - .expect("OK from server"); - }; - } - - #[tokio::test(flavor = "multi_thread")] - async fn test_client_receives_ok_from_server_after_job_push() { - if let Some(mut c) = get_connected_client().await { - c.init().await.unwrap(); - let j = JobBuilder::new("order").build(); - single::write_command_and_await_ok(&mut c.stream, &Push::from(j)) - .await - .unwrap(); - }; - } -}