Skip to content

Commit

Permalink
Attempt to fix access_clock_object_test by adding timestamp threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
Dkwcs committed Nov 2, 2024
1 parent 7175dfd commit 3fa3468
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/iota-e2e-tests/tests/shared_objects_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ async fn call_shared_object_contract() {

#[sim_test]
async fn access_clock_object_test() {
// Permitted timestamp tolerance for calculating potential time delay
let timestamp_tolerance_ms: u64 = 10;
let test_cluster = TestClusterBuilder::new().build().await;
let package_id = publish_basics_package(&test_cluster.wallet).await.0;

Expand Down Expand Up @@ -536,7 +538,10 @@ async fn access_clock_object_test() {

// Timestamp that we have read in a smart contract
// should match timestamp of the checkpoint where transaction is included
assert_eq!(checkpoint.timestamp_ms, event.timestamp_ms);
assert!((checkpoint.timestamp_ms as i64 - event.timestamp_ms as i64).abs() <= timestamp_tolerance_ms as i64,
"timestamps are not within the allowed tolerance. Checkpoint: {}, Event: {}",
checkpoint.timestamp_ms,
event.timestamp_ms);
break;
}
}
Expand Down

0 comments on commit 3fa3468

Please sign in to comment.