From 8049629b1155c8459b5c6ce74dd3374eb3fa7d92 Mon Sep 17 00:00:00 2001 From: Arshavir Ter-Gabrielyan Date: Fri, 17 Jan 2025 20:01:31 +0100 Subject: [PATCH] test(sns): Bump expected SNS dapp canister upgrade time from 30 to 60 seconds in testing (#3498) This PR aims to reduce flakiness in `//rs/sns/integration_tests/test_upgrade_canister_proposal_execution_fail` by bumping expected SNS dapp canister upgrade time from 30 to 60 seconds. --- rs/sns/integration_tests/src/upgrade_canister.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rs/sns/integration_tests/src/upgrade_canister.rs b/rs/sns/integration_tests/src/upgrade_canister.rs index 2eb886dc4a6..de01de27d3a 100644 --- a/rs/sns/integration_tests/src/upgrade_canister.rs +++ b/rs/sns/integration_tests/src/upgrade_canister.rs @@ -45,6 +45,8 @@ lazy_static! { pub static ref EMPTY_WASM: Vec = vec![0, 0x61, 0x73, 0x6D, 1, 0, 0, 0]; } +const EXPECTED_SNS_DAPP_CANISTER_UPGRADE_TIME_SECONDS: u64 = 60; + // Note: Tests for UpgradeSnsToNextVersion action is in rs/nns/sns-wasm/tests/upgrade_sns_instance.rs fn setup_sns( @@ -445,16 +447,16 @@ fn test_upgrade_canister_proposal_execution_fail() { action ), }; - fn age_s(t: u64) -> f64 { + fn age_s(t: u64) -> u64 { SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() - .as_secs_f64() - - (t as f64) + .as_secs() + .saturating_sub(t) } let decision_age_s = age_s(proposal.decided_timestamp_seconds); assert!( - decision_age_s < 30.0, + decision_age_s < EXPECTED_SNS_DAPP_CANISTER_UPGRADE_TIME_SECONDS, "decision_age_s: {}, proposal: {:?}", decision_age_s, proposal @@ -466,7 +468,7 @@ fn test_upgrade_canister_proposal_execution_fail() { ); let failure_age_s = age_s(proposal.failed_timestamp_seconds); assert!( - failure_age_s < 30.0, + failure_age_s < EXPECTED_SNS_DAPP_CANISTER_UPGRADE_TIME_SECONDS, "failure_age_s: {}, proposal: {:?}", failure_age_s, proposal