Skip to content

Commit

Permalink
fix: attempt to fix flaky test with 1s delay
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Jul 6, 2024
1 parent de5a588 commit de5344b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/katana/core/tests/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,14 @@ async fn test_increase_next_block_timestamp() {
let block2_timestamp =
BlockProvider::block(provider, block2.into()).unwrap().unwrap().header.timestamp;

assert_eq!(block2_timestamp, block1_timestamp + 1000, "timestamp should be updated");
// Depending on the current time and the machine we run on, we may have 1 sec difference
// between the expected and actual timestamp.
// We take this possible delay in account to have the test more robust for now,
// but it may due to how the timestamp is updated in the sequencer.
assert!(
block2_timestamp == block1_timestamp + 1000 || block2_timestamp == block1_timestamp + 1001,
"timestamp should be updated"
);
}

// #[tokio::test]
Expand Down

0 comments on commit de5344b

Please sign in to comment.