@@ -174,14 +174,14 @@ void indexingRescanOnOverflow() throws IOException, InterruptedException {
174174 .onOverflow (Approximation .DIFF )
175175 .on (bookkeeper );
176176
177- //Thread.sleep(TestHelper.NORMAL_WAIT.toMillis());
178177 try (var watch = watchConfig .start ()) {
179-
180178 // Begin overflow simulation
181179 dropEvents .set (true );
182180
183- // Perform some file operations. No events should be observed
184- // (because the overflow simulation is running).
181+ // Perform some file operations (after a short wait to ensure a new
182+ // last-modified-time). No events should be observed (because the
183+ // overflow simulation is running).
184+ Thread .sleep (TestHelper .SHORT_WAIT .toMillis ());
185185 Files .writeString (directory .resolve ("a.txt" ), "foo" );
186186 Files .writeString (directory .resolve ("b.txt" ), "bar" );
187187 Files .delete (directory .resolve ("c.txt" ));
@@ -207,9 +207,11 @@ void indexingRescanOnOverflow() throws IOException, InterruptedException {
207207 .until (() -> bookkeeper .events ().any (e ));
208208 }
209209
210+ bookkeeper .reset ();
211+
210212 // Perform some more file operations. All events should be observed
211213 // (because the overflow simulation is no longer running).
212- bookkeeper . reset ( );
214+ Thread . sleep ( TestHelper . SHORT_WAIT . toMillis () );
213215 Files .writeString (directory .resolve ("b.txt" ), "baz" );
214216 Files .createFile (directory .resolve ("c.txt" ));
215217 Files .delete (directory .resolve ("a.txt" ));
@@ -223,9 +225,10 @@ void indexingRescanOnOverflow() throws IOException, InterruptedException {
223225 .until (() -> bookkeeper .events ().any (e ));
224226 }
225227
228+ bookkeeper .reset ();
229+
226230 // Generate another `OVERFLOW` event. Synthetic events shouldn't be
227231 // issued and observed (because the index should have been updated).
228- bookkeeper .reset ();
229232 ((EventHandlingWatch ) watch ).handleEvent (overflow );
230233
231234 await ("No events should have been triggered" )
0 commit comments