Skip to content

Commit 6460c85

Browse files
authored
SERVER-81436 Read multiversion config from file instead of resmoke output (#69)
1 parent 3cb2918 commit 6460c85

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
target/
22
.emm-local.yml
33
.vscode
4+
multiversion-config.yml

CHANGELOG.md

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

3+
## 0.7.10 - 2022-09-25
4+
* SERVER-81436 Read multiversion config from file instead of resmoke output
5+
36
## 0.7.9 - 2022-07-31
47
* DAG-2777: Added better logging around yaml failures
58

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
@@ -2,7 +2,7 @@
22
name = "mongo-task-generator"
33
description = "Dynamically split evergreen tasks into subtasks for testing the mongodb/mongo project."
44
license = "Apache-2.0"
5-
version = "0.7.9"
5+
version = "0.7.10"
66
repository = "https://github.com/mongodb/mongo-task-generator"
77
authors = ["Decision Automation Group <[email protected]>"]
88
edition = "2018"

src/resmoke/resmoke_proxy.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,20 @@ impl MultiversionConfig {
156156
/// Query the multiversion configuration from resmoke.
157157
pub fn from_resmoke(cmd: &str, script: &[String]) -> Result<MultiversionConfig> {
158158
let mut cmd = vec![cmd];
159+
let file_name = "multiversion-config.yml";
159160
cmd.append(&mut script.iter().map(|s| s.as_str()).collect());
160161
cmd.append(&mut vec!["multiversion-config"]);
161-
let cmd_output = run_command(&cmd).unwrap();
162+
let file_arg = format!("--config-file-output={}", file_name);
163+
cmd.append(&mut vec![&file_arg]);
164+
run_command(&cmd).unwrap();
165+
let multiversion_config_output =
166+
std::fs::read_to_string(file_name).expect("Multiversion config file not found.");
162167
let multiversion_config: Result<MultiversionConfig, serde_yaml::Error> =
163-
serde_yaml::from_str(&cmd_output);
168+
serde_yaml::from_str(&multiversion_config_output);
164169
if multiversion_config.is_err() {
165170
error!(
166171
command = cmd.join(" "),
167-
command_output = &cmd_output,
172+
command_output = &multiversion_config_output,
168173
"Failed to parse yaml from multiversion config command output",
169174
);
170175
}

tests/mocks/resmoke.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
"""Mock of resmoke.py for testing task generation."""
22
import sys
3+
import os
34

45

56
def multiversion_config():
6-
print("""
7+
file_contents = """
78
last_versions:
89
- last_lts
910
- last_continuous
1011
requires_fcv_tag: requires_fcv_51,requires_fcv_52,requires_fcv_53,requires_fcv_60
11-
""")
12+
"""
13+
file_name = "multiversion-config.yml"
14+
if not os.path.exists(file_name):
15+
with open(file_name, "w") as file:
16+
file.write(file_contents)
1217

1318

1419
def suiteconfig():

0 commit comments

Comments
 (0)