Skip to content
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## 0.7.22 - 2025-01-22
* Avoid a division-by-zero when processing empty suites.

## 0.7.21 - 2025-01-16
* Add additional logging for task generation that takes a long time.

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mongo-task-generator"
description = "Dynamically split evergreen tasks into subtasks for testing the mongodb/mongo project."
license = "Apache-2.0"
version = "0.7.21"
version = "0.7.22"
repository = "https://github.com/mongodb/mongo-task-generator"
authors = ["Decision Automation Group <dev-prod-dag@mongodb.com>"]
edition = "2018"
Expand Down
28 changes: 27 additions & 1 deletion src/task_types/resmoke_tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,16 @@ impl GenResmokeTaskServiceImpl {
multiversion_name: Option<&str>,
multiversion_tags: Option<String>,
) -> Result<Vec<SubSuite>> {
let mut sub_suites = vec![];

let origin_suite = multiversion_name.unwrap_or(&params.suite_name);
let test_list = self.get_test_list(params, multiversion_name)?;
if test_list.is_empty() {
return Ok(sub_suites);
}
let n_suites = min(test_list.len(), self.config.n_suites);
let tasks_per_suite = test_list.len() / n_suites;

let mut sub_suites = vec![];
let mut current_tests = vec![];
let mut i = 0;
for test in test_list {
Expand Down Expand Up @@ -1306,6 +1310,28 @@ mod tests {
}
}

#[test]
fn test_split_task_fallback_empty_suite() {
let n_suites = 1;
let test_list = vec![];
let task_history = TaskRuntimeHistory {
task_name: "my task".to_string(),
test_map: hashmap! {},
};
let gen_resmoke_service =
build_mocked_service(test_list.clone(), task_history.clone(), n_suites);

let params = ResmokeGenParams {
..Default::default()
};

let sub_suites = gen_resmoke_service
.split_task_fallback(&params, None, None)
.unwrap();

assert_eq!(sub_suites.len(), 0);
}

// tests for get_test_list.
#[rstest]
#[case(true, 12)]
Expand Down