Skip to content
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

[TST] Scheduler test fix #1851

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions rust/worker/src/compactor/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ mod tests {
use crate::types::SegmentScope;
use num_bigint::BigInt;
use std::collections::HashMap;
use std::str::FromStr;
use std::time::Duration;
use uuid::Uuid;

Expand Down Expand Up @@ -271,7 +272,7 @@ mod tests {
async fn test_scheduler() {
let mut log = Box::new(InMemoryLog::new());

let collection_uuid_1 = Uuid::new_v4();
let collection_uuid_1 = Uuid::from_str("00000000-0000-0000-0000-000000000001").unwrap();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer hardcoded UUIDs for test

let collection_id_1 = collection_uuid_1.to_string();
log.add_log(
collection_id_1.clone(),
Expand All @@ -291,7 +292,7 @@ mod tests {
}),
);

let collection_uuid_2 = Uuid::new_v4();
let collection_uuid_2 = Uuid::from_str("00000000-0000-0000-0000-000000000002").unwrap();
let collection_id_2 = collection_uuid_2.to_string();
log.add_log(
collection_id_2.clone(),
Expand Down Expand Up @@ -341,7 +342,12 @@ mod tests {
scheduler.schedule().await;
let tasks = scheduler.get_tasks();
assert_eq!(tasks.len(), 2);
assert_eq!(tasks[0].collection_id, collection_id_1);
assert_eq!(tasks[1].collection_id, collection_id_2);
// TODO: 3/9 Tasks may be out of order since we have not yet implemented SysDB Get last compaction time. Use contains instead of equal.
let task_ids = tasks
.iter()
.map(|t| t.collection_id.clone())
.collect::<Vec<String>>();
assert!(task_ids.contains(&collection_id_1));
assert!(task_ids.contains(&collection_id_2));
}
}
2 changes: 1 addition & 1 deletion rust/worker/src/log/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) struct CollectionInfo {
pub(crate) first_log_id_ts: i64,
}

#[derive(Clone)]
#[derive(Clone, Debug)]
pub(crate) struct CollectionRecord {
pub(crate) id: String,
pub(crate) tenant_id: String,
Expand Down
Loading