Skip to content

Commit

Permalink
De-flake test_txn_rejection_rate test (#16746)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
halfprice authored Mar 19, 2024
1 parent f342716 commit 768fcb6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/sui-core/src/overload_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 768fcb6

Please sign in to comment.