Skip to content

Commit

Permalink
Merge pull request #5 from mfactory-lab/dev
Browse files Browse the repository at this point in the history
fix: runner tests
  • Loading branch information
tiamo authored Aug 8, 2023
2 parents afb52b4 + 6d4c1a8 commit a220f27
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/task_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,15 +467,18 @@ mod tests {

assert_eq!(cmd[0], "ansible-playbook");
assert_eq!(cmd[1], "--inventory=localhost,");
assert_eq!(cmd[2], format!("./playbooks/{}.yaml", task.name));
assert_eq!(
cmd[2 + TASK_EXTRA_VARS.len()],
format!("./playbooks/{}.yaml", task.name)
);

env::set_var("DOCKER_HOST_IP", "1.2.3.4");
task.args = HashMap::from([("a".to_string(), "1".to_string())]);

let cmd = runner.build_cmd(&task);

assert_eq!(cmd[1], "--inventory=1.2.3.4,");
assert_eq!(cmd[2], "--extra-vars={\"a\":\"1\"}");
assert_eq!(cmd[2 + TASK_EXTRA_VARS.len()], "--extra-vars={\"a\":\"1\"}");
}

#[tokio::test]
Expand All @@ -487,7 +490,7 @@ mod tests {
let mut runner = get_task_runner();

let task = Task {
id: 0,
id: 1,
secret: "".to_string(),
name: "test".to_string(),
args: HashMap::from([("sleep".to_string(), "10".to_string())]),
Expand Down

0 comments on commit a220f27

Please sign in to comment.