mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-24 00:40:40 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user