Skip to content

Commit

Permalink
vmm task: should kill all process even no bundle
Browse files Browse the repository at this point in the history
Signed-off-by: yuqitao <[email protected]>
  • Loading branch information
yuqitao committed Aug 31, 2023
1 parent 8b29e8f commit 132f391
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion vmm/task/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async fn should_kill_all_on_exit(bundle_path: &str) -> bool {
"failed to read spec when call should_kill_all_on_exit: {}",
e
);
false
true
}
}
}
Expand All @@ -124,3 +124,19 @@ pub fn has_shared_pid_namespace(spec: &Spec) -> bool {
},
}
}

#[cfg(test)]
mod tests {
use crate::task::should_kill_all_on_exit;
use std::path::Path;

#[tokio::test]
async fn test_should_kill_all_on_exit_when_no_path() {
let path = "fake-path";
// fake-path should not exist
assert!(!Path::new(path).exists());

// return true if path not exist
assert!(should_kill_all_on_exit(path).await);
}
}

0 comments on commit 132f391

Please sign in to comment.