Skip to content

Commit a01f471

Browse files
authored
improve: timouts for integration test (#3121)
Signed-off-by: Attila Mészáros <[email protected]>
1 parent f1fb2f9 commit a01f471

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

operator-framework/src/test/java/io/javaoperatorsdk/operator/IntegrationTestConstants.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
*/
1616
package io.javaoperatorsdk.operator;
1717

18+
import java.time.Duration;
19+
1820
public class IntegrationTestConstants {
1921

2022
public static final int GARBAGE_COLLECTION_TIMEOUT_SECONDS = 60;
23+
24+
public static final Duration GARBAGE_COLLECTION_TIMEOUT = Duration.ofSeconds(60);
2125
}

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/expectation/onallevent/ExpectationIT.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import io.javaoperatorsdk.annotation.Sample;
2525
import io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension;
2626

27+
import static io.javaoperatorsdk.operator.IntegrationTestConstants.GARBAGE_COLLECTION_TIMEOUT;
2728
import static io.javaoperatorsdk.operator.baseapi.expectation.onallevent.ExpectationReconciler.DEPLOYMENT_READY;
2829
import static org.assertj.core.api.Assertions.assertThat;
2930
import static org.awaitility.Awaitility.await;
@@ -52,6 +53,7 @@ void testExpectation() {
5253
extension.create(res);
5354

5455
await()
56+
.timeout(GARBAGE_COLLECTION_TIMEOUT)
5557
.untilAsserted(
5658
() -> {
5759
var actual = extension.get(ExpectationCustomResource.class, TEST_1);
@@ -67,6 +69,7 @@ void expectationTimeouts() {
6769
extension.create(res);
6870

6971
await()
72+
.timeout(GARBAGE_COLLECTION_TIMEOUT)
7073
.untilAsserted(
7174
() -> {
7275
var actual = extension.get(ExpectationCustomResource.class, TEST_1);

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/expectation/periodicclean/PeriodicCleanerExpectationIT.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import io.javaoperatorsdk.annotation.Sample;
2525
import io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension;
2626

27+
import static io.javaoperatorsdk.operator.IntegrationTestConstants.GARBAGE_COLLECTION_TIMEOUT;
2728
import static io.javaoperatorsdk.operator.baseapi.expectation.periodicclean.PeriodicCleanerExpectationReconciler.DEPLOYMENT_READY;
2829
import static org.assertj.core.api.Assertions.assertThat;
2930
import static org.awaitility.Awaitility.await;
@@ -57,6 +58,7 @@ void testPeriodicCleanerExpectationBasicFlow() {
5758
extension.create(res);
5859

5960
await()
61+
.timeout(GARBAGE_COLLECTION_TIMEOUT)
6062
.untilAsserted(
6163
() -> {
6264
var actual = extension.get(PeriodicCleanerExpectationCustomResource.class, TEST_1);
@@ -80,6 +82,7 @@ void demonstratesNoTriggerReconcilerOnAllEventsNeededForCleanup() {
8082
var created = extension.create(res);
8183

8284
await()
85+
.timeout(GARBAGE_COLLECTION_TIMEOUT)
8386
.untilAsserted(
8487
() -> {
8588
assertThat(reconciler.getExpectationManager().getExpectation(created)).isPresent();

operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/standalonedependent/StandaloneDependentResourceIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void executeUpdateForTestingCacheUpdateForGetResource() {
9393
void awaitForDeploymentReadyReplicas(int expectedReplicaCount) {
9494
await()
9595
.pollInterval(Duration.ofMillis(300))
96-
.atMost(Duration.ofSeconds(50))
96+
.atMost(Duration.ofSeconds(180))
9797
.until(
9898
() -> {
9999
var deployment =

operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/complexdependent/ComplexWorkflowIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void successfullyReconciles() {
5555
operator.create(testResource());
5656

5757
await()
58-
.atMost(Duration.ofSeconds(90))
58+
.atMost(Duration.ofSeconds(120))
5959
.untilAsserted(
6060
() -> {
6161
var res = operator.get(ComplexWorkflowCustomResource.class, TEST_RESOURCE_NAME);

operator-framework/src/test/java/io/javaoperatorsdk/operator/workflow/workflowallfeature/WorkflowAllFeatureIT.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import io.javaoperatorsdk.annotation.Sample;
2828
import io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension;
2929

30+
import static io.javaoperatorsdk.operator.IntegrationTestConstants.GARBAGE_COLLECTION_TIMEOUT;
3031
import static io.javaoperatorsdk.operator.workflow.workflowallfeature.ConfigMapDependentResource.READY_TO_DELETE_ANNOTATION;
3132
import static org.assertj.core.api.Assertions.assertThat;
3233
import static org.awaitility.Awaitility.await;
@@ -69,7 +70,7 @@ void configMapNotReconciledUntilDeploymentReady() {
6970
});
7071

7172
await()
72-
.atMost(ONE_MINUTE)
73+
.timeout(ONE_MINUTE)
7374
.untilAsserted(
7475
() -> {
7576
assertThat(
@@ -107,6 +108,7 @@ void configMapNotReconciledIfReconcileConditionNotMet() {
107108
operator.replace(resource);
108109

109110
await()
111+
.timeout(GARBAGE_COLLECTION_TIMEOUT)
110112
.untilAsserted(
111113
() -> {
112114
assertThat(operator.get(ConfigMap.class, RESOURCE_NAME)).isNotNull();
@@ -141,7 +143,7 @@ void configMapNotDeletedUntilNotMarked() {
141143
markConfigMapForDelete();
142144

143145
await()
144-
.atMost(ONE_MINUTE)
146+
.timeout(GARBAGE_COLLECTION_TIMEOUT)
145147
.untilAsserted(
146148
() -> {
147149
assertThat(operator.get(ConfigMap.class, RESOURCE_NAME)).isNull();

0 commit comments

Comments
 (0)