Skip to content

Commit 440090f

Browse files
committed
test: improve await reliability
Signed-off-by: Marc Nuri <[email protected]>
1 parent 27592cf commit 440090f

File tree

5 files changed

+9
-19
lines changed

5 files changed

+9
-19
lines changed

exec/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@
4040
<artifactId>java-hamcrest</artifactId>
4141
<scope>test</scope>
4242
</dependency>
43-
<dependency>
44-
<groupId>org.awaitility</groupId>
45-
<artifactId>awaitility</artifactId>
46-
<scope>test</scope>
47-
</dependency>
4843
</dependencies>
4944
<build>
5045
<plugins>

exec/src/test/java/com/marcnuri/demo/kubernetesclient/ExecITCase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import java.io.ByteArrayOutputStream;
1212
import java.nio.charset.StandardCharsets;
1313
import java.util.Collections;
14-
import java.util.Objects;
1514
import java.util.concurrent.CountDownLatch;
1615
import java.util.concurrent.TimeUnit;
1716

@@ -51,7 +50,8 @@ static void tearDown() {
5150

5251
private static void deletePod() {
5352
kc.pods().withName("busybox").withGracePeriod(1L).delete();
54-
kc.pods().withName("busybox").waitUntilCondition(Objects::isNull, 10, TimeUnit.SECONDS);
53+
kc.pods().withName("busybox").waitUntilCondition(p ->
54+
p == null || p.getMetadata().getDeletionTimestamp() != null, 10, TimeUnit.SECONDS);
5555
}
5656

5757
@Test

other/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
<name>${global.name} :: Other Examples</name>
1515

1616
<dependencies>
17+
<dependency>
18+
<groupId>org.slf4j</groupId>
19+
<artifactId>slf4j-simple</artifactId>
20+
</dependency>
1721
<dependency>
1822
<groupId>io.fabric8</groupId>
1923
<artifactId>openshift-client</artifactId>
@@ -30,10 +34,6 @@
3034
<groupId>org.assertj</groupId>
3135
<artifactId>assertj-core</artifactId>
3236
</dependency>
33-
<dependency>
34-
<groupId>org.awaitility</groupId>
35-
<artifactId>awaitility</artifactId>
36-
</dependency>
3737
</dependencies>
3838
<build>
3939
<plugins>

upload/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
<artifactId>java-hamcrest</artifactId>
3737
<scope>test</scope>
3838
</dependency>
39-
<dependency>
40-
<groupId>org.awaitility</groupId>
41-
<artifactId>awaitility</artifactId>
42-
<scope>test</scope>
43-
</dependency>
4439
</dependencies>
4540
<build>
4641
<plugins>

upload/src/test/java/com/marcnuri/demo/kubernetesclient/UploadITCase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import java.nio.file.Path;
1616
import java.util.Collections;
17-
import java.util.Objects;
1817
import java.util.concurrent.TimeUnit;
1918

2019
import static com.marcnuri.demo.kubernetesclient.Utils.execCommand;
@@ -56,8 +55,9 @@ static void tearDown() {
5655
}
5756

5857
private static void deletePod() {
59-
kc.pods().withName(name).withGracePeriod(1L).delete();
60-
kc.pods().withName(name).waitUntilCondition(Objects::isNull, 10, TimeUnit.SECONDS);
58+
kc.pods().withName(name).withGracePeriod(0L).delete();
59+
kc.pods().withName(name).waitUntilCondition(p ->
60+
p == null || p.getMetadata().getDeletionTimestamp() != null, 10, TimeUnit.SECONDS);
6161
}
6262

6363
@Test

0 commit comments

Comments
 (0)