Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vid201 committed Sep 5, 2023
1 parent edfa4ff commit 1cc4ab8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions bin/silius/src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions crates/rpc/tests/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}

0 comments on commit 1cc4ab8

Please sign in to comment.