1
0
mirror of https://github.com/containers/youki synced 2024-11-23 17:32:15 +01:00

address comment

This commit is contained in:
tommady 2021-11-05 00:17:01 +00:00
parent f5fa26960a
commit 3a11ccbd5a
No known key found for this signature in database
GPG Key ID: 15E4E2B7957CF963

@ -293,6 +293,7 @@ mod tests {
.write(true)
.create(true)
.open(tmp_dir.path().join("scmp_file"))?;
std::fs::OpenOptions::new()
.write(true)
.create(true)
@ -305,7 +306,7 @@ mod tests {
let state = ContainerProcessState::default();
let want = serde_json::to_string(&state)?;
let seccomp_th = thread::spawn(move || {
let th = thread::spawn(move || {
sync_seccomp(
&LinuxSeccompBuilder::default()
.listener_path(socket_path_seccomp_th)
@ -323,20 +324,17 @@ mod tests {
});
let fd = scmp_file.into_raw_fd();
let notify_th = thread::spawn(move || {
assert!(main_sender.seccomp_notify_request(fd).is_ok());
assert!(init_receiver.wait_for_seccomp_request_done().is_ok());
});
fs::remove_file(socket_path.clone())?;
let lis = UnixListener::bind(socket_path)?;
let (mut socket, _) = lis.accept()?;
let mut got = String::new();
socket.read_to_string(&mut got)?;
assert!(init_receiver.wait_for_seccomp_request_done().is_ok());
assert_eq!(want, got);
assert!(notify_th.join().is_ok());
assert!(seccomp_th.join().is_ok());
assert!(th.join().is_ok());
Ok(())
}
}