From 1cc4ab843ed4868d3088254a6c1f55c366fc517d Mon Sep 17 00:00:00 2001 From: Vid Kersic Date: Wed, 6 Sep 2023 00:20:50 +0200 Subject: [PATCH] fix: tests --- bin/silius/src/cli/args.rs | 4 ++-- crates/rpc/tests/rpc.rs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/silius/src/cli/args.rs b/bin/silius/src/cli/args.rs index a9a7f18e..e176306c 100644 --- a/bin/silius/src/cli/args.rs +++ b/bin/silius/src/cli/args.rs @@ -394,7 +394,7 @@ mod tests { String::from("debug"), String::from("web3") ], - http_corsdomain: vec![String::from("_")], + http_corsdomain: vec![String::from("127.0.0.1:4321")], ws: false, ws_addr: IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), ws_port: 3001, @@ -493,7 +493,7 @@ mod tests { String::from("debug"), String::from("web3") ], - http_corsdomain: vec![String::from("_")], + http_corsdomain: vec![String::from("127.0.0.1:4321")], ws: false, ws_addr: IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), ws_port: 3001, diff --git a/crates/rpc/tests/rpc.rs b/crates/rpc/tests/rpc.rs index 235ae1dc..44d39c73 100644 --- a/crates/rpc/tests/rpc.rs +++ b/crates/rpc/tests/rpc.rs @@ -71,10 +71,11 @@ async fn only_ws_rpc_server() { #[tokio::test] async fn http_and_ws_rpc_server() { let addr = IpAddr::from(ADDRESS); - let port = test_port(); + let http_port = test_port(); + let ws_port = test_port(); let http = true; let ws = true; - let mut server = JsonRpcServer::new(http, addr.clone(), port, ws, addr.clone(), port); + let mut server = JsonRpcServer::new(http, addr.clone(), http_port, ws, addr.clone(), ws_port); let chain_id: U64 = U64::from(0x7a69); server @@ -85,18 +86,17 @@ async fn http_and_ws_rpc_server() { .unwrap(); let (http_handle, ws_handle) = server.start().await.unwrap(); - tokio::spawn({ - http_handle.unwrap().stopped().await; - ws_handle.unwrap().stopped() - }); + + tokio::spawn(http_handle.unwrap().stopped()); + tokio::spawn(ws_handle.unwrap().stopped()); // http client return success response - let http_client = build_http_client(addr.clone(), port).unwrap(); + let http_client = build_http_client(addr.clone(), http_port).unwrap(); let http_response = DummyEthApiClient::chain_id(&http_client).await.unwrap(); assert_eq!(http_response, chain_id); // ws client return success response - let ws_client = build_ws_client(addr, port).await.unwrap(); + let ws_client = build_ws_client(addr, ws_port).await.unwrap(); let ws_response = DummyEthApiClient::chain_id(&ws_client).await.unwrap(); assert_eq!(ws_response, chain_id); }