1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#![allow(dead_code, clippy::missing_panics_doc, clippy::must_use_candidate)] use std::fs; use std::path::PathBuf; use std::time::{SystemTime, UNIX_EPOCH}; fn fixture_path(name: &str) -> PathBuf { PathBuf::from(env!("CARGO_MANIFEST_DIR")) .join("tests") .join("fixtures") .join(name) } pub fn fixture(name: &str) -> Vec<u8> { fs::read(fixture_path(name)).expect("fixture should exist") } pub fn unique_service(prefix: &str) -> String { let nanos = SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap_or_default() .as_nanos(); format!("security-rs.{prefix}.{}.{}", std::process::id(), nanos) }