3939import java .util .Collections ;
4040import java .util .Set ;
4141import java .util .concurrent .ConcurrentHashMap ;
42- import java .util .concurrent .ConcurrentLinkedDeque ;
4342import java .util .concurrent .Executor ;
4443import java .util .concurrent .Executors ;
4544import java .util .concurrent .LinkedBlockingDeque ;
5857import org .junit .jupiter .api .Test ;
5958import org .junit .jupiter .api .condition .EnabledIfEnvironmentVariable ;
6059
61- import engineering .swat .watch .WatchEvent .Kind ;
62-
6360class TortureTests {
6461
6562 private final Logger logger = LogManager .getLogger ();
@@ -77,7 +74,7 @@ void setup() throws IOException {
7774 }
7875
7976 @ AfterEach
80- void cleanup () throws IOException {
77+ void cleanup () {
8178 if (testDir != null ) {
8279 testDir .close ();
8380 }
@@ -97,7 +94,7 @@ private final class IOGenerator {
9794 }
9895 }
9996
100- private final static int BURST_SIZE = 1000 ;
97+ private static final int BURST_SIZE = 1000 ;
10198
10299 private void startJob (final Path root , Random r , Executor exec ) {
103100 exec .execute (() -> {
@@ -246,7 +243,6 @@ void manyRegistrationsForSamePath() throws InterruptedException, IOException {
246243 done .acquire (TORTURE_REGISTRATION_THREADS - 1 );
247244 assertTrue (seen .isEmpty (), "No events should have been sent" );
248245 var target = testDir .getTestDirectory ().resolve ("test124.txt" );
249- //logger.info("Writing: {}", target);
250246 Files .writeString (target , "Hello World" );
251247 var expected = Collections .singleton (target );
252248 await ("We should see only one event" )
@@ -331,8 +327,6 @@ void manyRegisterAndUnregisterSameTime() throws InterruptedException, IOExceptio
331327
332328 }
333329
334-
335-
336330 @ Test
337331 //Deletes can race the filesystem, so you might miss a few files in a dir, if that dir is already deleted
338332 @ EnabledIfEnvironmentVariable (named ="TORTURE_DELETE" , matches ="true" )
@@ -370,7 +364,7 @@ void pressureOnFSShouldNotMissDeletes() throws InterruptedException, IOException
370364 });
371365
372366 try (var activeWatch = watchConfig .start () ) {
373- logger .info ("Deleting files now" , THREADS );
367+ logger .info ("Deleting files now ({} threads) " , THREADS );
374368 testDir .deleteAllFiles ();
375369 logger .info ("Waiting for the events processing to stabilize" );
376370 waitForStable (events , happened );
0 commit comments