From 43cea0df91f29509f69e1083cf1b68645e18c8f9 Mon Sep 17 00:00:00 2001 From: Vlad Lazar Date: Thu, 6 Mar 2025 11:23:25 +0000 Subject: [PATCH] pageserver: allow for unit test stress test (#11112) ## Problem I like using `cargo stress` to hammer on a test, but it doesn't work out of the box because it does parallel runs by default and tests always use the same repo dir. ## Summary of changes Add an uuid to the test repo dir when generating it. --- Cargo.lock | 1 + pageserver/Cargo.toml | 1 + pageserver/src/config.rs | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7aa9c53e7e..67f0fa4b77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4303,6 +4303,7 @@ dependencies = [ "tracing", "url", "utils", + "uuid", "wal_decoder", "walkdir", "workspace_hack", diff --git a/pageserver/Cargo.toml b/pageserver/Cargo.toml index 7330856be4..fa16090170 100644 --- a/pageserver/Cargo.toml +++ b/pageserver/Cargo.toml @@ -98,6 +98,7 @@ criterion.workspace = true hex-literal.workspace = true tokio = { workspace = true, features = ["process", "sync", "fs", "rt", "io-util", "time", "test-util"] } indoc.workspace = true +uuid.workspace = true [[bench]] name = "bench_layer_map" diff --git a/pageserver/src/config.rs b/pageserver/src/config.rs index 33ae8c4790..582019d96f 100644 --- a/pageserver/src/config.rs +++ b/pageserver/src/config.rs @@ -491,7 +491,9 @@ impl PageServerConf { #[cfg(test)] pub fn test_repo_dir(test_name: &str) -> Utf8PathBuf { let test_output_dir = std::env::var("TEST_OUTPUT").unwrap_or("../tmp_check".into()); - Utf8PathBuf::from(format!("{test_output_dir}/test_{test_name}")) + + let test_id = uuid::Uuid::new_v4(); + Utf8PathBuf::from(format!("{test_output_dir}/test_{test_name}_{test_id}")) } pub fn dummy_conf(repo_dir: Utf8PathBuf) -> Self {