Skip to content

Commit

Permalink
fix: ignore flaky tests (#947)
Browse files Browse the repository at this point in the history
  • Loading branch information
andysim3d authored and dancoombs committed Dec 20, 2024
1 parent 02d9d77 commit a77876c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crates/provider/src/alloy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,30 @@ mod tests {

use crate::new_alloy_provider;
fn setup() {
let server = Server::http("0.0.0.0:8000").unwrap();
let server = Server::http("0.0.0.0:9009").unwrap();
for request in server.incoming_requests() {
sleep(Duration::from_secs(10));
sleep(Duration::from_secs(5));
let _ = request.respond(Response::from_string(
"{\"jsonrpc\": \"2.0\", \"id\": 1, \"result\": \"0x146b6d7\"}",
));
}
}
#[ignore = "this test is flaky with github action, should only run locally"]
#[tokio::test]
async fn test_timeout() {
thread::spawn(move || {
setup();
});
{
// Wait 11 seconds and get result
let provider = new_alloy_provider("http://localhost:8000", 15)
let provider = new_alloy_provider("http://localhost:9009", 15)
.expect("can not initialize provider");
let x = provider.get_block_number().await;
assert!(x.is_ok());
}
{
// Wait 9 seconds and timeout form client side
let provider = new_alloy_provider("http://localhost:8000", 5)
let provider = new_alloy_provider("http://localhost:9009", 1)
.expect("can not initialize provider");
let x = provider.get_block_number().await;
assert!(x.is_err());
Expand Down

0 comments on commit a77876c

Please sign in to comment.