Skip to content

Commit d2484dc

Browse files
committed
test: integration test fixes
1 parent 85a12d9 commit d2484dc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

crates/api/tests/ledger_integration.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
use std::{
2727
env,
2828
sync::{
29-
Arc,
29+
Arc, LazyLock,
3030
atomic::{AtomicI64, Ordering},
3131
},
3232
};
@@ -50,7 +50,13 @@ use inferadb_engine_store::InferaStore;
5050
use inferadb_engine_types::{AuthContext, AuthMethod, Relationship};
5151
use tower::ServiceExt;
5252

53-
static TEST_ID_COUNTER: AtomicI64 = AtomicI64::new(20000000000000);
53+
/// Test ID counter initialized with PID-based offset to avoid collisions when
54+
/// nextest runs tests in parallel processes. Each process gets a unique 10,000-ID
55+
/// range based on its PID modulo 1000.
56+
static TEST_ID_COUNTER: LazyLock<AtomicI64> = LazyLock::new(|| {
57+
let pid = std::process::id() as i64;
58+
AtomicI64::new(20000000000000 + (pid % 1000) * 10000)
59+
});
5460

5561
fn generate_test_id() -> i64 {
5662
TEST_ID_COUNTER.fetch_add(1, Ordering::SeqCst)

0 commit comments

Comments
 (0)