MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / unique_socket_path

Function unique_socket_path

crates/openshell-driver-podman/src/test_utils.rs:39–48  ·  view source on GitHub ↗

Generate a unique Unix socket path for a test. Uses the current PID and nanosecond timestamp to avoid collisions between concurrent test runs.

(test_name: &str)

Source from the content-addressed store, hash-verified

37/// Uses the current PID and nanosecond timestamp to avoid collisions between
38/// concurrent test runs.
39pub fn unique_socket_path(test_name: &str) -> PathBuf {
40 let nanos = SystemTime::now()
41 .duration_since(UNIX_EPOCH)
42 .expect("clock should be after unix epoch")
43 .as_nanos();
44 PathBuf::from(format!(
45 "/tmp/openshell-podman-{test_name}-{}-{nanos}.sock",
46 std::process::id()
47 ))
48}
49
50/// Spawn a Unix-socket HTTP stub that serves the given `responses` in order.
51///

Calls

no outgoing calls

Tested by

no test coverage detected