@@ -24,6 +24,8 @@ use nodedb_wal::record::RecordType;
2424use nodedb_wal:: segmented:: { SegmentedWal , SegmentedWalConfig } ;
2525use tempfile:: tempdir;
2626
27+ static OBSERVABILITY_LOCK : std:: sync:: Mutex < ( ) > = std:: sync:: Mutex :: new ( ( ) ) ;
28+
2729fn tiny_segment_wal ( wal_dir : & std:: path:: Path ) -> SegmentedWal {
2830 let mut cfg = SegmentedWalConfig :: for_testing ( wal_dir. to_path_buf ( ) ) ;
2931 // Tiny segments so a handful of appends forces rollover.
@@ -50,6 +52,7 @@ fn write_n_records(wal_dir: &std::path::Path, records: usize) -> Vec<u64> {
5052
5153#[ test]
5254fn reader_open_advises_sequential ( ) {
55+ let _guard = OBSERVABILITY_LOCK . lock ( ) . unwrap ( ) ;
5356 let dir = tempdir ( ) . unwrap ( ) ;
5457 let wal_dir = dir. path ( ) ;
5558 write_n_records ( wal_dir, 1 ) ;
@@ -66,6 +69,7 @@ fn reader_open_advises_sequential() {
6669
6770#[ test]
6871fn replay_limit_from_last_segment_opens_only_last_segment ( ) {
72+ let _guard = OBSERVABILITY_LOCK . lock ( ) . unwrap ( ) ;
6973 let dir = tempdir ( ) . unwrap ( ) ;
7074 let wal_dir = dir. path ( ) ;
7175 write_n_records ( wal_dir, 5 ) ;
@@ -89,6 +93,7 @@ fn replay_limit_from_last_segment_opens_only_last_segment() {
8993
9094#[ test]
9195fn replay_skips_segments_entirely_below_from_lsn ( ) {
96+ let _guard = OBSERVABILITY_LOCK . lock ( ) . unwrap ( ) ;
9297 let dir = tempdir ( ) . unwrap ( ) ;
9398 let wal_dir = dir. path ( ) ;
9499 write_n_records ( wal_dir, 4 ) ;
@@ -111,6 +116,7 @@ fn replay_skips_segments_entirely_below_from_lsn() {
111116
112117#[ test]
113118fn replay_limit_returns_only_records_in_range ( ) {
119+ let _guard = OBSERVABILITY_LOCK . lock ( ) . unwrap ( ) ;
114120 // Behaviour spec: even with skipping, the set of returned records
115121 // must equal the set of records with lsn >= from_lsn, in LSN order.
116122 let dir = tempdir ( ) . unwrap ( ) ;
@@ -128,6 +134,7 @@ fn replay_limit_returns_only_records_in_range() {
128134#[ test]
129135#[ cfg( target_os = "linux" ) ]
130136fn fadvise_dontneed_called_after_segment_iteration ( ) {
137+ let _guard = OBSERVABILITY_LOCK . lock ( ) . unwrap ( ) ;
131138 // Spec: after iterating a segment to end during replay, the fd's pages
132139 // must be hinted via POSIX_FADV_DONTNEED so replay doesn't retain
133140 // hot pages from segments that won't be read again.
0 commit comments