From 4c37310105de1c6cf7927c4274ebd747f2a8d2f2 Mon Sep 17 00:00:00 2001 From: Mark Raynsford Date: Sun, 29 Sep 2024 16:11:11 +0000 Subject: [PATCH] Work around more flaky tests. --- .../java/com/io7m/laurel/tests/LFileModelExportTest.java | 6 +++++- .../java/com/io7m/laurel/tests/LFileModelImportTest.java | 9 ++++++--- .../main/java/com/io7m/laurel/tests/LFileModelTest.java | 4 ++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelExportTest.java b/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelExportTest.java index 986189e..099aeb0 100644 --- a/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelExportTest.java +++ b/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelExportTest.java @@ -40,7 +40,6 @@ import java.nio.file.Path; import java.util.HashMap; import java.util.List; -import java.util.Objects; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -71,8 +70,13 @@ public void setup( @AfterEach public void tearDown() + throws InterruptedException { + /* + * A delay to give Windows time to cope with the SQLite database being closed. + */ + Thread.sleep(1_000L); } @Test diff --git a/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelImportTest.java b/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelImportTest.java index 670fd37..477fb54 100644 --- a/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelImportTest.java +++ b/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelImportTest.java @@ -23,7 +23,6 @@ import com.io7m.laurel.gui.internal.LPerpetualSubscriber; import com.io7m.laurel.model.LException; import com.io7m.laurel.model.LImageWithID; -import com.io7m.zelador.test_extension.CloseableResourcesType; import com.io7m.zelador.test_extension.ZeladorExtension; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -62,8 +61,7 @@ public final class LFileModelImportTest @BeforeEach public void setup( - final @TempDir Path directory, - final CloseableResourcesType resources) + final @TempDir Path directory) { this.directory = directory; this.outputFile = directory.resolve("out.db"); @@ -72,8 +70,13 @@ public void setup( @AfterEach public void tearDown() + throws InterruptedException { + /* + * A delay to give Windows time to cope with the SQLite database being closed. + */ + Thread.sleep(1_000L); } @Test diff --git a/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelTest.java b/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelTest.java index 2e7b7ad..00e3406 100644 --- a/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelTest.java +++ b/com.io7m.laurel.tests/src/main/java/com/io7m/laurel/tests/LFileModelTest.java @@ -125,6 +125,10 @@ public void tearDown() { this.model.close(); + /* + * A delay to give Windows time to cope with the SQLite database being closed. + */ + Thread.sleep(1_000L); }