Skip to content

Commit f830cda

Browse files
committed
test: integration test fixes
1 parent 13d8bb3 commit f830cda

File tree

2 files changed

+47
-39
lines changed

2 files changed

+47
-39
lines changed

Cargo.lock

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/storage/tests/ledger_integration_tests.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
use std::{
1616
env,
1717
ops::Bound,
18-
sync::atomic::{AtomicI64, Ordering},
18+
sync::{
19+
LazyLock,
20+
atomic::{AtomicI64, Ordering},
21+
},
1922
time::Duration,
2023
};
2124

@@ -28,7 +31,12 @@ use tokio::time::sleep;
2831
// Test Configuration
2932
// ============================================================================
3033

31-
static VAULT_COUNTER: AtomicI64 = AtomicI64::new(30000);
34+
// Process-unique base to prevent vault ID collisions when nextest spawns separate processes.
35+
// Each process gets a unique 10000-vault range based on its PID.
36+
static VAULT_COUNTER: LazyLock<AtomicI64> = LazyLock::new(|| {
37+
let pid = std::process::id() as i64;
38+
AtomicI64::new(30000 + (pid % 1000) * 10000)
39+
});
3240

3341
fn should_run() -> bool {
3442
env::var("RUN_LEDGER_INTEGRATION_TESTS").is_ok()
@@ -43,7 +51,7 @@ fn ledger_namespace_id() -> i64 {
4351
}
4452

4553
fn unique_vault_id() -> i64 {
46-
VAULT_COUNTER.fetch_add(1, Ordering::SeqCst)
54+
VAULT_COUNTER.fetch_add(1, Ordering::Relaxed)
4755
}
4856

4957
async fn create_ledger_backend() -> LedgerBackend {

0 commit comments

Comments
 (0)