From 61724386efefbd7be14ba93369d6450033e9f81b Mon Sep 17 00:00:00 2001 From: dennis zhuang Date: Sat, 1 Nov 2025 06:08:59 +0800 Subject: [PATCH] fix: potential failure in tests (#7167) * fix: potential failure in the test_index_build_type_compact test Signed-off-by: Dennis Zhuang * fix: relax timestamp checking in test_timestamp_default_now Signed-off-by: Dennis Zhuang --------- Signed-off-by: Dennis Zhuang --- src/mito2/src/engine/index_build_test.rs | 4 +++- src/pipeline/tests/pipeline.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mito2/src/engine/index_build_test.rs b/src/mito2/src/engine/index_build_test.rs index 404aa3ad01..4cee12a81c 100644 --- a/src/mito2/src/engine/index_build_test.rs +++ b/src/mito2/src/engine/index_build_test.rs @@ -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); } diff --git a/src/pipeline/tests/pipeline.rs b/src/pipeline/tests/pipeline.rs index 0e6019ab47..ca94dbe3f0 100644 --- a/src/pipeline/tests/pipeline.rs +++ b/src/pipeline/tests/pipeline.rs @@ -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); } }); }