Skip to content

Commit 333e7ef

Browse files
committed
Merge branch 'main' into jdk-base-watcher
2 parents 377df56 + b07727f commit 333e7ef

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed

src/test/java/engineering/swat/watch/DeleteLockTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ static void setupEverything() {
6262
Awaitility.setDefaultTimeout(TestHelper.NORMAL_WAIT);
6363
}
6464

65-
6665
@FunctionalInterface
6766
private interface Deleter {
6867
void run(Path target) throws IOException;

src/test/java/engineering/swat/watch/RecursiveWatchTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ static void setupEverything() {
6666
Awaitility.setDefaultTimeout(TestHelper.NORMAL_WAIT);
6767
}
6868

69-
7069
@Test
7170
void newDirectoryWithFilesChangesDetected() throws IOException {
7271
var target = new AtomicReference<Path>();

src/test/java/engineering/swat/watch/SmokeTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,4 @@ void watchSingleFile() throws IOException {
112112
await("Single file change").untilTrue(changed);
113113
}
114114
}
115-
116-
117115
}

src/test/java/engineering/swat/watch/TestHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class TestHelper {
3737
static {
3838
var delayFactorConfig = System.getenv("DELAY_FACTOR");
3939
int delayFactor = delayFactorConfig == null ? 1 : Integer.parseInt(delayFactorConfig);
40-
var os = System.getProperty("os", "?").toLowerCase();
40+
var os = System.getProperty("os.name", "?").toLowerCase();
4141
if (os.contains("mac")) {
4242
// OSX is SLOW on it's watches
4343
delayFactor *= 2;

src/test/java/engineering/swat/watch/TortureTests.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949

5050
import org.apache.logging.log4j.LogManager;
5151
import org.apache.logging.log4j.Logger;
52+
import org.awaitility.Awaitility;
5253
import org.junit.jupiter.api.AfterEach;
54+
import org.junit.jupiter.api.BeforeAll;
5355
import org.junit.jupiter.api.BeforeEach;
5456
import org.junit.jupiter.api.RepeatedTest;
5557
import org.junit.jupiter.api.Test;
@@ -61,6 +63,11 @@ class TortureTests {
6163

6264
private TestDirectory testDir;
6365

66+
@BeforeAll
67+
static void setupEverything() {
68+
Awaitility.setDefaultTimeout(TestHelper.LONG_WAIT.getSeconds(), TimeUnit.SECONDS);
69+
}
70+
6471
@BeforeEach
6572
void setup() throws IOException {
6673
testDir = new TestDirectory();
@@ -236,7 +243,6 @@ void manyRegistrationsForSamePath() throws InterruptedException, IOException {
236243
done.acquire(TORTURE_REGISTRATION_THREADS - 1);
237244
assertTrue(seen.isEmpty(), "No events should have been sent");
238245
var target = testDir.getTestDirectory().resolve("test124.txt");
239-
//logger.info("Writing: {}", target);
240246
Files.writeString(target, "Hello World");
241247
var expected = Collections.singleton(target);
242248
await("We should see only one event")
@@ -321,8 +327,6 @@ void manyRegisterAndUnregisterSameTime() throws InterruptedException, IOExceptio
321327

322328
}
323329

324-
325-
326330
@Test
327331
//Deletes can race the filesystem, so you might miss a few files in a dir, if that dir is already deleted
328332
@EnabledIfEnvironmentVariable(named="TORTURE_DELETE", matches="true")
@@ -360,7 +364,7 @@ void pressureOnFSShouldNotMissDeletes() throws InterruptedException, IOException
360364
});
361365

362366
try (var activeWatch = watchConfig.start() ) {
363-
logger.info("Deleting files now", THREADS);
367+
logger.info("Deleting files now ({} threads)", THREADS);
364368
testDir.deleteAllFiles();
365369
logger.info("Waiting for the events processing to stabilize");
366370
waitForStable(events, happened);

src/test/java/engineering/swat/watch/impl/BundlingTests.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
import engineering.swat.watch.impl.util.BundledSubscription;
5555
import engineering.swat.watch.impl.util.ISubscribable;
5656

57-
public class BundlingTests {
57+
class BundlingTests {
5858

5959
private final Logger logger = LogManager.getLogger();
6060
private BundledSubscription<Long, Boolean> target;
@@ -77,8 +77,7 @@ void publish(Long x) {
7777
s.accept(true);
7878
}
7979
}
80-
};
81-
80+
}
8281

8382
@BeforeEach
8483
void setup() {
@@ -134,7 +133,7 @@ void manySubscriptions() throws IOException {
134133
}
135134

136135
@RepeatedTest(failureThreshold = 1, value=50)
137-
void parallelSubscriptions() throws IOException, InterruptedException {
136+
void parallelSubscriptions() throws InterruptedException {
138137
var hits = new AtomicInteger();
139138
var endPointReached = new Semaphore(0);
140139
var waitingForClose = new Semaphore(0);
@@ -171,5 +170,4 @@ void parallelSubscriptions() throws IOException, InterruptedException {
171170
.untilAtomic(hits, IsEqual.equalTo(active));
172171
waitingForClose.release(active);
173172
}
174-
175173
}

0 commit comments

Comments
 (0)