mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-28 20:47:49 +01:00
Server: use awaitility in quarkus tests
This commit is contained in:
@@ -54,6 +54,12 @@
|
||||
<version>1.18.34</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<version>4.2.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
<artifactId>testcontainers</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.usatiuk</groupId>
|
||||
<artifactId>autoprotomap</artifactId>
|
||||
|
||||
@@ -17,8 +17,11 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.awaitility.Awaitility.await;
|
||||
|
||||
class Profiles {
|
||||
public static class DhfsFileServiceSimpleTestProfile implements QuarkusTestProfile {
|
||||
@Override
|
||||
@@ -228,14 +231,14 @@ public class DhfsFileServiceSimpleTestImpl {
|
||||
Assertions.assertArrayEquals(new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
|
||||
fileService.read(fileService.open("/moveOverTest2").get(), 0, 10).get().toByteArray());
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
try {
|
||||
chunkObj.runReadLocked(JObjectManager.ResolutionStrategy.LOCAL_ONLY, (m, d) -> {
|
||||
Assertions.assertFalse(m.getReferrers().contains(uuid));
|
||||
return null;
|
||||
});
|
||||
} catch (DeletedObjectAccessException ignored) {}
|
||||
await().atMost(5, TimeUnit.SECONDS).until(() -> {
|
||||
try {
|
||||
return chunkObj.runReadLocked(JObjectManager.ResolutionStrategy.LOCAL_ONLY,
|
||||
(m, d) -> !m.getReferrers().contains(uuid));
|
||||
} catch (DeletedObjectAccessException ignored) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user