mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
agent: Improve unit test coverage for src/sandbox.rs
Improve unit test coverage for src/sandbox.rs fixes #293 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
157dd041b2
commit
2e1a8f0ae9
@ -707,4 +707,31 @@ mod tests {
|
||||
assert!(s.hooks.as_ref().unwrap().poststart.is_empty());
|
||||
assert!(s.hooks.as_ref().unwrap().poststop.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn test_sandbox_is_running() {
|
||||
let logger = slog::Logger::root(slog::Discard, o!());
|
||||
let mut s = Sandbox::new(&logger).unwrap();
|
||||
s.running = true;
|
||||
assert!(s.is_running());
|
||||
s.running = false;
|
||||
assert!(!s.is_running());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sandbox_set_hostname() {
|
||||
let logger = slog::Logger::root(slog::Discard, o!());
|
||||
let mut s = Sandbox::new(&logger).unwrap();
|
||||
let hostname = "abc123";
|
||||
s.set_hostname(hostname.to_string());
|
||||
assert_eq!(s.hostname, hostname);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sandbox_set_destroy() {
|
||||
let logger = slog::Logger::root(slog::Discard, o!());
|
||||
let mut s = Sandbox::new(&logger).unwrap();
|
||||
let ret = s.destroy();
|
||||
assert!(ret.is_ok());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user