Skip to content

Commit 0babc64

Browse files
DAG-1928: Add support for generating burn_in_tags (#41)
1 parent 378c21e commit 0babc64

File tree

8 files changed

+639
-21
lines changed

8 files changed

+639
-21
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.4.7 - 2022-07-14
4+
5+
* Add support for burn_in_tags generation.
6+
37
## 0.4.6 - 2022-07-01
48

59
* Add support for burn_in_tests generation.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mongo-task-generator"
3-
version = "0.4.6"
3+
version = "0.4.7"
44
repository = "https://github.com/mongodb/mongo-task-generator"
55
authors = ["Decision Automation Group <[email protected]>"]
66
edition = "2018"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ graph TD
132132
G --> |Yes| H[Split task by test runtimes]
133133
G --> |No| I[Split task by counts]
134134
H --> J[Generate resmoke suite config]
135-
I -> J
135+
I --> J
136136
J --> |generated task definitions|B
137137
B --> |done|K[For each Build Variant]
138138
K --> L[Create task specs and display tasks in Build Variant]

src/evergreen/evg_config_utils.rs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,22 @@ pub trait EvgConfigUtils: Sync + Send {
124124
build_variant: &BuildVariant,
125125
) -> Option<String>;
126126

127+
/// Lookup and split by whitespace the specified expansion in the given build variant.
128+
///
129+
/// # Arguments
130+
///
131+
/// * `name` - Name of expansion to query.
132+
/// * `build_variant` - Build Variant to query.
133+
///
134+
/// # Returns
135+
///
136+
/// List of values of expansion splitted by whitespace if it exists.
137+
fn lookup_and_split_by_whitespace_build_variant_expansion(
138+
&self,
139+
name: &str,
140+
build_variant: &BuildVariant,
141+
) -> Vec<String>;
142+
127143
/// Lookup the given variable in the task definition.
128144
///
129145
/// # Arguments
@@ -410,6 +426,28 @@ impl EvgConfigUtils for EvgConfigUtilsImpl {
410426
.map(|v| v.to_string())
411427
}
412428

429+
/// Lookup and split by whitespace the specified expansion in the given build variant.
430+
///
431+
/// # Arguments
432+
///
433+
/// * `name` - Name of expansion to query.
434+
/// * `build_variant` - Build Variant to query.
435+
///
436+
/// # Returns
437+
///
438+
/// List of values of expansion splitted by whitespace if it exists.
439+
fn lookup_and_split_by_whitespace_build_variant_expansion(
440+
&self,
441+
name: &str,
442+
build_variant: &BuildVariant,
443+
) -> Vec<String> {
444+
self.lookup_build_variant_expansion(name, build_variant)
445+
.unwrap_or_default()
446+
.split_whitespace()
447+
.map(|s| s.to_string())
448+
.collect()
449+
}
450+
413451
/// Lookup the given variable in the task definition.
414452
///
415453
/// # Arguments
@@ -1060,6 +1098,56 @@ mod tests {
10601098
assert_eq!(lookup, Some("expansion value".to_string()));
10611099
}
10621100

1101+
// lookup_and_split_by_whitespace_build_variant_expansion tests
1102+
#[test]
1103+
fn test_lookup_and_split_by_whitespace_in_a_build_variant_with_no_expansions_should_return_none(
1104+
) {
1105+
let build_variant = BuildVariant {
1106+
..Default::default()
1107+
};
1108+
let evg_config_utils = EvgConfigUtilsImpl::new();
1109+
1110+
let lookup = evg_config_utils
1111+
.lookup_and_split_by_whitespace_build_variant_expansion("my expansion", &build_variant);
1112+
1113+
assert!(lookup.is_empty());
1114+
}
1115+
1116+
#[test]
1117+
fn test_lookup_and_split_by_whitespace_in_a_build_variant_with_missing_expansion_should_return_none(
1118+
) {
1119+
let build_variant = BuildVariant {
1120+
expansions: Some(btreemap! {
1121+
"expansion".to_string() => "build variant value".to_string(),
1122+
}),
1123+
..Default::default()
1124+
};
1125+
let evg_config_utils = EvgConfigUtilsImpl::new();
1126+
1127+
let lookup = evg_config_utils
1128+
.lookup_and_split_by_whitespace_build_variant_expansion("my expansion", &build_variant);
1129+
1130+
assert!(lookup.is_empty());
1131+
}
1132+
1133+
#[test]
1134+
fn test_lookup_and_split_by_whitespace_in_a_build_variant_with_expected_expansion_should_return_value(
1135+
) {
1136+
let build_variant = BuildVariant {
1137+
expansions: Some(btreemap! {
1138+
"expansion".to_string() => "build variant value".to_string(),
1139+
"my expansion".to_string() => "expansion value".to_string(),
1140+
}),
1141+
..Default::default()
1142+
};
1143+
let evg_config_utils = EvgConfigUtilsImpl::new();
1144+
1145+
let lookup = evg_config_utils
1146+
.lookup_and_split_by_whitespace_build_variant_expansion("my expansion", &build_variant);
1147+
1148+
assert_eq!(lookup, vec!["expansion".to_string(), "value".to_string()]);
1149+
}
1150+
10631151
// lookup_* tests.
10641152
#[test]
10651153
fn test_lookup_required_should_return_error_if_no_var() {

src/evergreen_names.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ pub const GENERATE_RESMOKE_TASKS: &str = "generate resmoke tasks";
3434
pub const GENERATOR_TASKS: &str = "generator_tasks";
3535
/// Name of burn_in_tests task.
3636
pub const BURN_IN_TESTS: &str = "burn_in_tests_gen";
37+
/// Name of burn_in_tags task.
38+
pub const BURN_IN_TAGS: &str = "burn_in_tags_gen";
39+
/// Name of compile task group.
40+
pub const COMPILE_TASK_GROUP_NAME: &str = "compile_and_archive_dist_test_TG";
3741

3842
// Vars
3943
/// Variable that indicates a task is a fuzzer.
@@ -81,6 +85,10 @@ pub const MULTIVERSION_EXCLUDE_TAGS: &str = "multiversion_exclude_tags_version";
8185
// Build Variant expansions.
8286
/// Name of large distro for build variant.
8387
pub const LARGE_DISTRO_EXPANSION: &str = "large_distro_name";
88+
/// List of build variant names delimited by spaces to generate burn_in_tags for.
89+
pub const BURN_IN_TAG_BUILD_VARIANTS: &str = "burn_in_tag_buildvariants";
90+
/// Name of build variant to determine the timeouts for.
91+
pub const BURN_IN_BYPASS: &str = "burn_in_bypass";
8492

8593
// Task Tags
8694
/// Tag to include multiversion setup is required.
@@ -99,3 +107,7 @@ pub const MULTIVERSION_EXCLUDE_TAGS_FILE: &str = "multiversion_exclude_tags.yml"
99107
pub const MULTIVERSION_LAST_LTS: &str = "last_lts";
100108
/// Name of last continuous configuration.
101109
pub const MULTIVERSION_LAST_CONTINUOUS: &str = "last_continuous";
110+
111+
// Distros
112+
/// Name of compile task distro for burn_in_tags.
113+
pub const COMPILE_TASK_DISTRO: &str = "rhel80-xlarge";

0 commit comments

Comments
 (0)