libs: Fix test_get_uds_with_sid_ok

Preset directory `kata98654sandboxpath1` will produce more than one
`target_id` in `get_uds_with_sid`, which causes test to fail. Remove
that directory to make this test work.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
Ruoqing He
2025-09-10 07:50:27 +00:00
parent efeba0b8ed
commit b10e5a2250

View File

@@ -138,10 +138,8 @@ mod tests {
#[test] #[test]
fn test_get_uds_with_sid_ok() { fn test_get_uds_with_sid_ok() {
let run_path = tempdir().unwrap(); let run_path = tempdir().unwrap();
let dir1 = run_path.path().join("kata98654sandboxpath1"); let dir = run_path.path().join("aata98654dangboxpath1");
let dir2 = run_path.path().join("aata98654dangboxpath1"); fs::create_dir_all(dir.as_path()).unwrap();
fs::create_dir_all(dir1.as_path()).unwrap();
fs::create_dir_all(dir2.as_path()).unwrap();
let result = get_uds_with_sid("kata", &run_path.path().display().to_string()); let result = get_uds_with_sid("kata", &run_path.path().display().to_string());
assert!(result.is_ok()); assert!(result.is_ok());
@@ -151,7 +149,7 @@ mod tests {
"unix://{}", "unix://{}",
run_path run_path
.path() .path()
.join("kata98654sandboxpath1") .join("kata")
.join(SHIM_MGMT_SOCK_NAME) .join(SHIM_MGMT_SOCK_NAME)
.display() .display()
) )