Skip to content

Commit

Permalink
MTG-1110 Add request time out for DB query
Browse files Browse the repository at this point in the history
- minor code style fix
  • Loading branch information
andrii-kl committed Jan 14, 2025
1 parent 8c75888 commit 653518e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions nft_ingester/tests/api_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,11 @@ mod tests {
let result = timeout(query_timeout, query("SELECT pg_sleep(3)").execute(&pg_pool)).await;

match result {
Ok(Ok(res)) => assert!(
false,
Ok(Ok(res)) => panic!(
"Query should have timed out, but completed successfully: {:?}",
res
),
Ok(Err(e)) => assert!(false, "Query should have timed out, but failed: {:?}", e),
Ok(Err(e)) => panic!("Query should have timed out, but failed: {:?}", e),
Err(_) => println!("Query timed out as expected"),
}
}
Expand All @@ -544,15 +543,11 @@ mod tests {

match result {
Ok(Ok(res)) => println!("Query completed successfully: {:?}", res),
Ok(Err(e)) => assert!(
false,
"Query should completed successfully, but failed: {:?}",
Ok(Err(e)) => panic!(
"Query should have timed out, but completed successfully: {:?}",
e
),
Err(_) => assert!(
false,
"Query should completed successfully but have timedout",
),
Err(_) => panic!("Query should completed successfully but have timeout",),
}
}

Expand Down

0 comments on commit 653518e

Please sign in to comment.