misc: improve test idempotence (unrelated improvement)
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
parent
562af123d5
commit
265d21b0c4
1 changed files with 6 additions and 0 deletions
|
|
@ -871,6 +871,7 @@ impl VsockMuxer {
|
|||
#[cfg(test)]
|
||||
mod unit_tests {
|
||||
use std::cmp::min;
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
|
|
@ -921,6 +922,8 @@ mod unit_tests {
|
|||
)
|
||||
.unwrap();
|
||||
let uds_path = format!("test_vsock_{name}.sock");
|
||||
// Clear in case it is still there from a previous run
|
||||
let _ = fs::remove_file(&uds_path);
|
||||
let muxer = VsockMuxer::new(PEER_CID, uds_path).unwrap();
|
||||
|
||||
Self {
|
||||
|
|
@ -1049,6 +1052,9 @@ mod unit_tests {
|
|||
}
|
||||
impl LocalListener {
|
||||
fn new<P: AsRef<Path> + Clone>(path: P) -> Self {
|
||||
// Clear in case it is still there from a previous run
|
||||
let _ = fs::remove_file(path.as_ref());
|
||||
|
||||
let path_buf = path.as_ref().to_path_buf();
|
||||
let sock = UnixListener::bind(path).unwrap();
|
||||
sock.set_nonblocking(true).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue