From a5733877a465255ed00c962dba0b53ee293e0298 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Wed, 20 Nov 2024 18:19:18 +0000 Subject: [PATCH 1/2] ci: Fix error on self-hosted machines We need to clean-up any created files/dirs otherwise we cause problems on self-hosted runners. Using tempdir which will be removed automatically. Signed-off-by: Zvonko Kaiser --- src/agent/src/device/mod.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/agent/src/device/mod.rs b/src/agent/src/device/mod.rs index dc5c81d057..403c38d1ae 100644 --- a/src/agent/src/device/mod.rs +++ b/src/agent/src/device/mod.rs @@ -1192,9 +1192,8 @@ mod tests { ); spec.set_annotations(Some(annotations)); - // create a file in /tmp/cdi with nvidia.json content - let cdi_dir = PathBuf::from("/tmp/cdi"); - let cdi_file = cdi_dir.join("kata.json"); + let temp_dir = tempdir().expect("Failed to create temporary directory"); + let cdi_file = temp_dir.path().join("kata.json"); let cdi_version = "0.6.0"; let kind = "kata.com/gpu"; @@ -1242,10 +1241,10 @@ mod tests { }}"# ); - fs::create_dir_all(&cdi_dir).unwrap(); - fs::write(&cdi_file, cdi_content).unwrap(); + fs::write(&cdi_file, cdi_content).expect("Failed to write CDI file"); - let res = handle_cdi_devices(&logger, &mut spec, "/tmp/cdi", 0).await; + let res = + handle_cdi_devices(&logger, &mut spec, temp_dir.path().to_str().unwrap(), 0).await; println!("modfied spec {:?}", spec); assert!(res.is_ok(), "{}", res.err().unwrap()); From e9f36f81874d1b5e8edb74608be0f25a632b4034 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Wed, 20 Nov 2024 18:20:54 +0000 Subject: [PATCH 2/2] ci: Fixing simple typo change evn to env Signed-off-by: Zvonko Kaiser --- src/agent/src/device/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agent/src/device/mod.rs b/src/agent/src/device/mod.rs index 403c38d1ae..400b6f1386 100644 --- a/src/agent/src/device/mod.rs +++ b/src/agent/src/device/mod.rs @@ -1260,7 +1260,7 @@ mod tests { let env = spec.process().as_ref().unwrap().env().as_ref().unwrap(); - // find string TEST_OUTER_ENV in evn + // find string TEST_OUTER_ENV in env let outer_env = env.iter().find(|e| e.starts_with("TEST_OUTER_ENV")); assert!(outer_env.is_some(), "TEST_OUTER_ENV not found in env");