Skip to content

Commit ca95567

Browse files
committed
fix: ensure MockSystem uses mocked command outputs
1 parent 47124ed commit ca95567

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utils/worker_mock.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub mod tests {
2727
fn default() -> Self {
2828
Self::new(Distribution {
2929
id: "Ubuntu".to_string(),
30-
release: "24.10".to_string(),
30+
release: "24.04".to_string(),
3131
})
3232
}
3333
}
@@ -73,8 +73,12 @@ pub mod tests {
7373
impl Worker for MockSystem {
7474
fn run(&self, cmd: &Command) -> Result<Output> {
7575
self.commands.borrow_mut().push(cmd.command());
76+
let mocked = self.mocked_commands.borrow();
77+
let default_stdout = String::default();
78+
let stdout = mocked.get(&cmd.command()).unwrap_or(&default_stdout);
79+
7680
Ok(Output {
77-
stdout: Vec::new(),
81+
stdout: stdout.as_bytes().to_vec(),
7882
stderr: Vec::new(),
7983
status: std::process::ExitStatus::default(),
8084
})

0 commit comments

Comments
 (0)