File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 2626use 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;
5050use inferadb_engine_types:: { AuthContext , AuthMethod , Relationship } ;
5151use 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
5561fn generate_test_id ( ) -> i64 {
5662 TEST_ID_COUNTER . fetch_add ( 1 , Ordering :: SeqCst )
You can’t perform that action at this time.
0 commit comments