Skip to content

flaky test ModuleEnvironmentWatcherTest #108

@keturn

Description

@keturn

org.terasology.gestalt.assets.module.autoreload.ModuleEnvironmentWatcherTest.test()

It sometimes passes, and sometimes on CI it does not

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:40)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:35)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:162)
	at org.terasology.gestalt.assets.module.autoreload.ModuleEnvironmentWatcherTest.test(ModuleEnvironmentWatcherTest.java:91)

AssetType<Text, TextData> assetType = new AssetType<>(Text.class, new TextFactory());
watcher.register("text", subscriber, assetType);
watcher.checkForChanges();
Files.createDirectories(tempDirectory.resolve("assets").resolve("text"));
watcher.checkForChanges();
Files.createFile(tempDirectory.resolve("assets").resolve("text").resolve("test.txt"));
SetMultimap<AssetType<?, ?>, ResourceUrn> changed = watcher.checkForChanges();
assertTrue(changed.containsEntry(assetType, new ResourceUrn(module.getId(), new Name("test.txt"))));
try (Writer writer = Files.newBufferedWriter(tempDirectory.resolve("assets").resolve("text").resolve("test.txt"))) {
writer.write("This is my text");
}
changed = watcher.checkForChanges();
assertTrue(changed.containsEntry(assetType, new ResourceUrn(module.getId(), new Name("test.txt"))));
FilesUtil.recursiveDelete(tempDirectory);
watcher.checkForChanges();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugIssues reporting and PRs fixing problems

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions