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)
| 37 | /// Uses the current PID and nanosecond timestamp to avoid collisions between |
| 38 | /// concurrent test runs. |
| 39 | pub 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 | /// |
no outgoing calls
no test coverage detected