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); } }); }