mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
kata-ctl: add unit test for kvm check
Check that kvm test fails when run as non-root and when device specified is not /dev/kvm. Fixes #5338 Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
This commit is contained in:
parent
a085a6d7b4
commit
5f8008b69c
@ -395,6 +395,7 @@ mod tests {
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use tempfile::tempdir;
|
||||
use test_utils::skip_if_root;
|
||||
|
||||
#[test]
|
||||
fn test_get_single_cpu_info() {
|
||||
@ -522,6 +523,16 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_kvm_is_usable_generic() {
|
||||
skip_if_root!();
|
||||
#[allow(dead_code)]
|
||||
let result = check_kvm_is_usable_generic();
|
||||
assert!(
|
||||
result.err().unwrap().to_string() == "Will not perform kvm checks as non root user"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_kata_all_releases_by_url() {
|
||||
#[derive(Debug)]
|
||||
|
Loading…
Reference in New Issue
Block a user