Skip to content

Commit 5193daf

Browse files
Fix panic while generatic a timestamp
If random::<i64>() produces i64::MIN, calling .abs() on it causes an overflow. This commit fixes that by using random::<u64>().
1 parent 14d9fdd commit 5193daf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scylla/tests/integration/statement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ async fn test_timestamp_generator() {
259259

260260
impl TimestampGenerator for LocalTimestampGenerator {
261261
fn next_timestamp(&self) -> i64 {
262-
let timestamp = random::<i64>().abs();
262+
let timestamp = (random::<u64>() as i64).abs();
263263
self.generated_timestamps.lock().unwrap().insert(timestamp);
264264
timestamp
265265
}

0 commit comments

Comments
 (0)