Skip to content

Commit 27d24bf

Browse files
taniwha3dmah42
andauthored
Add unit test for default socket address (#587)
Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
1 parent 365fc1e commit 27d24bf

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

auraed/src/lib.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,3 +355,25 @@ pub fn prep_oci_spec_for_spawn(output: &str) -> Result<(), anyhow::Error> {
355355
.map_err(|e| anyhow!("building default oci spec: {e}"))?;
356356
spawn_auraed_oci_to(PathBuf::from(output), spec)
357357
}
358+
359+
#[cfg(test)]
360+
mod tests {
361+
use super::*;
362+
363+
#[test]
364+
fn auraed_runtime_default_socket_address_should_use_runtime_dir() {
365+
let default_runtime = AuraedRuntime::default();
366+
assert_eq!(
367+
default_runtime.default_socket_address(),
368+
PathBuf::from("/var/run/aurae/aurae.sock")
369+
);
370+
371+
let custom_runtime_dir = PathBuf::from("/tmp/aurae-test-runtime");
372+
let mut runtime = AuraedRuntime::default();
373+
runtime.runtime_dir = custom_runtime_dir.clone();
374+
assert_eq!(
375+
runtime.default_socket_address(),
376+
custom_runtime_dir.join("aurae.sock")
377+
);
378+
}
379+
}

0 commit comments

Comments
 (0)