fix: potential failure in tests (#7167)

* fix: potential failure in the test_index_build_type_compact test

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix: relax timestamp checking in test_timestamp_default_now

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
This commit is contained in:
dennis zhuang
2025-11-01 06:08:59 +08:00
committed by GitHub
parent 6960a0183a
commit 61724386ef
2 changed files with 4 additions and 2 deletions

View File

@@ -220,7 +220,8 @@ async fn test_index_build_type_compact() {
.await
.unwrap();
assert!(scanner.num_files() == 2);
assert!(num_of_index_files(&engine, &scanner, region_id).await < 2);
// Compaction is an async task, so it may be finished at this moment.
assert!(num_of_index_files(&engine, &scanner, region_id).await <= 2);
// Wait a while to make sure index build tasks are finished.
listener.wait_stop(5).await; // 4 flush + 1 compaction = some abort + some finish
@@ -229,6 +230,7 @@ async fn test_index_build_type_compact() {
.await
.unwrap();
assert!(scanner.num_files() == 2);
// Index files should be built.
assert!(num_of_index_files(&engine, &scanner, region_id).await == 2);
}

View File

@@ -855,7 +855,7 @@ transform:
row.0.values.into_iter().for_each(|v| {
if let ValueData::TimestampNanosecondValue(v) = v.value_data.unwrap() {
let now = chrono::Utc::now().timestamp_nanos_opt().unwrap();
assert!(now - v < 1_000_000);
assert!(now - v < 5_000_000);
}
});
}