From 768fcb6bb60d0f5817b2f6687ac59bc4433d3e7d Mon Sep 17 00:00:00 2001 From: Zhe Wu Date: Mon, 18 Mar 2024 22:16:59 -0700 Subject: [PATCH] De-flake test_txn_rejection_rate test (#16746) ## Description By widening the error margin. Also added debug logging. Ran 2000 times and all passed. ## Test Plan How did you test the new or updated feature? --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes --- crates/sui-core/src/overload_monitor.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/sui-core/src/overload_monitor.rs b/crates/sui-core/src/overload_monitor.rs index 5d046f9a7e431..43c12528605a6 100644 --- a/crates/sui-core/src/overload_monitor.rs +++ b/crates/sui-core/src/overload_monitor.rs @@ -737,9 +737,13 @@ mod tests { } } - // Give it a 2% fluctuation. - assert!(rejection_percentage as f32 / 100.0 - 0.02 < reject_count as f32 / 10000.0); - assert!(reject_count as f32 / 10000.0 < rejection_percentage as f32 / 100.0 + 0.02); + debug!( + "Rejection percentage: {:?}, reject count: {:?}.", + rejection_percentage, reject_count + ); + // Give it a 3% fluctuation. + assert!(rejection_percentage as f32 / 100.0 - 0.03 < reject_count as f32 / 10000.0); + assert!(reject_count as f32 / 10000.0 < rejection_percentage as f32 / 100.0 + 0.03); } }