-
Notifications
You must be signed in to change notification settings - Fork 494
Refactor test_cmd_garbage_collect_spares_files_within_grace_period
#2169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Please, add more asserts in your tests. Hitting the desired code path is not enough... |
quickwit/quickwit-cli/tests/cli.rs
Outdated
|
|
||
| #[tokio::test] | ||
| async fn test_cmd_garbage_collect_spares_files_within_grace_period() -> Result<()> { | ||
| async fn test_cmd_garbage_collect_spares_files_within_grace_period() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| async fn test_cmd_garbage_collect_spares_files_within_grace_period() { | |
| async fn test_garbage_collect_index_cli() { |
quickwit/quickwit-cli/tests/cli.rs
Outdated
| data_dir: None, | ||
| }; | ||
|
|
||
| garbage_collect_index_cli(args).await.unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be followed by an assert...
quickwit/quickwit-cli/tests/cli.rs
Outdated
| let args = GarbageCollectIndexArgs { | ||
| config_uri: test_env.config_uri.clone(), | ||
| index_id: index_id.clone(), | ||
| grace_period: Duration::from_secs(2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably shorten this to 1s
quickwit/quickwit-cli/tests/cli.rs
Outdated
|
|
||
| // Wait for grace period. | ||
| // TODO: edit split update timestamps and remove this sleep. | ||
| sleep(Duration::from_secs(3)).await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and sleep here for 2s.
|
|
||
| Ok(()) | ||
| garbage_collect_index_cli(args).await.unwrap(); | ||
| assert_eq!(split_path.exists(), false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need an assert on the number of splits in the metastore.
No description provided.