mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-02 00:02:01 +00:00
Merge pull request #4705 from bergwolf/github/agent-ut-improve
UT: test_load_kernel_module needs root
This commit is contained in:
commit
2b5dc2ad39
@ -1457,7 +1457,12 @@ impl LinuxContainer {
|
||||
linux.cgroups_path.clone()
|
||||
};
|
||||
|
||||
let cgroup_manager = FsManager::new(cpath.as_str())?;
|
||||
let cgroup_manager = FsManager::new(cpath.as_str()).map_err(|e| {
|
||||
anyhow!(format!(
|
||||
"fail to create cgroup manager with path {}: {:}",
|
||||
cpath, e
|
||||
))
|
||||
})?;
|
||||
info!(logger, "new cgroup_manager {:?}", &cgroup_manager);
|
||||
|
||||
Ok(LinuxContainer {
|
||||
|
@ -840,7 +840,8 @@ pub fn get_mount_fs_type_from_file(mount_file: &str, mount_point: &str) -> Resul
|
||||
return Err(anyhow!("Invalid mount point {}", mount_point));
|
||||
}
|
||||
|
||||
let content = fs::read_to_string(mount_file)?;
|
||||
let content = fs::read_to_string(mount_file)
|
||||
.map_err(|e| anyhow!("read mount file {}: {}", mount_file, e))?;
|
||||
|
||||
let re = Regex::new(format!("device .+ mounted on {} with fstype (.+)", mount_point).as_str())?;
|
||||
|
||||
|
@ -2078,6 +2078,7 @@ mod tests {
|
||||
let result = load_kernel_module(&m);
|
||||
assert!(result.is_err(), "load module should failed");
|
||||
|
||||
skip_if_not_root!();
|
||||
// case 3: normal module.
|
||||
// normally this module should eixsts...
|
||||
m.name = "bridge".to_string();
|
||||
|
Loading…
Reference in New Issue
Block a user