mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-17 14:58:16 +00:00
libs: Fix test_execute_hook test
Case 4 of `test_execute_hook` would fail because `args` could not be empty, while by providing `build_oci_hook` with `vec![]` would result in empty args at execution stage. Modify `build_oci_hook` to set args as `None` when empty vector is provided. Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
@@ -375,7 +375,11 @@ mod tests {
|
||||
fn build_oci_hook(self) -> oci::Hook {
|
||||
let mut hook = oci::Hook::default();
|
||||
hook.set_path(PathBuf::from(self.path));
|
||||
hook.set_args(Some(self.args));
|
||||
if self.args.is_empty() {
|
||||
hook.set_args(None);
|
||||
} else {
|
||||
hook.set_args(Some(self.args));
|
||||
}
|
||||
hook.set_env(Some(self.env));
|
||||
hook.set_timeout(self.timeout);
|
||||
|
||||
|
Reference in New Issue
Block a user