Skip to content

Commit 8ecfef6

Browse files
committed
improve: resource creation api in JUnit extension
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 7d17e4c commit 8ecfef6

File tree

42 files changed

+68
-53
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+68
-53
lines changed

caffeine-bounded-cache-support/src/test/java/io/javaoperatorsdk/operator/processing/event/source/cache/BoundedCacheTestBase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private void updateTestResources() {
6363
IntStream.range(0, NUMBER_OF_RESOURCE_TO_TEST).forEach(i -> {
6464
var cm = extension().get(ConfigMap.class, RESOURCE_NAME_PREFIX + i);
6565
cm.getData().put(DATA_KEY, UPDATED_PREFIX + i);
66-
extension().replace(cm);
66+
extension().createOrUpdate(cm);
6767
});
6868
}
6969

operator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/AbstractOperatorExtension.java

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import io.fabric8.kubernetes.api.model.*;
2121
import io.fabric8.kubernetes.client.KubernetesClient;
2222
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
23+
import io.fabric8.kubernetes.client.dsl.NonDeletingOperation;
2324
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
2425
import io.fabric8.kubernetes.client.dsl.Resource;
2526
import io.fabric8.kubernetes.client.utils.Utils;
@@ -107,6 +108,16 @@ public <T extends HasMetadata> T get(Class<T> type, String name) {
107108
return kubernetesClient.resources(type).inNamespace(namespace).withName(name).get();
108109
}
109110

111+
public <T extends HasMetadata> T createOr(T resource,
112+
Function<NonDeletingOperation<T>, T> conflictAction) {
113+
return kubernetesClient.resource(resource).inNamespace(namespace).createOr(conflictAction);
114+
}
115+
116+
public <T extends HasMetadata> T createOrUpdate(T resource) {
117+
return kubernetesClient.resource(resource).inNamespace(namespace)
118+
.createOr(NonDeletingOperation::update);
119+
}
120+
110121
public <T extends HasMetadata> T create(T resource) {
111122
return kubernetesClient.resource(resource).inNamespace(namespace).create();
112123
}
@@ -116,6 +127,10 @@ public <T extends HasMetadata> T create(Class<T> type, T resource) {
116127
return create(resource);
117128
}
118129

130+
/**
131+
* Use createOrUpdate instead.
132+
*/
133+
@Deprecated(forRemoval = true)
119134
public <T extends HasMetadata> T replace(T resource) {
120135
return kubernetesClient.resource(resource).inNamespace(namespace).replace();
121136
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void addNewAndRemoveOldNamespaceTest() {
7171

7272
ConfigMap firstMap = operator.get(ConfigMap.class, TEST_RESOURCE_NAME_1);
7373
firstMap.setData(Map.of("data", "newdata"));
74-
operator.replace(firstMap);
74+
operator.createOrUpdate(firstMap);
7575
assertReconciled(reconciler, defaultNamespaceResource);
7676
}
7777

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void cleanupRemovesFinalizerWithoutConflict() throws InterruptedException {
3939
testResource = operator.get(CleanupConflictCustomResource.class, TEST_RESOURCE_NAME);
4040
testResource.getMetadata().getFinalizers().remove(ADDITIONAL_FINALIZER);
4141
testResource.getMetadata().setResourceVersion(null);
42-
operator.replace(testResource);
42+
operator.createOrUpdate(testResource);
4343

4444
await().pollDelay(Duration.ofMillis(WAIT_TIME * 2)).untilAsserted(
4545
() -> assertThat(operator.getReconcilerOfType(CleanupConflictReconciler.class)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void crudOperationOnClusterScopedCustomResource() {
4040
});
4141

4242
resource.getSpec().setData(UPDATED_DATA);
43-
operator.replace(resource);
43+
operator.createOrUpdate(resource);
4444
await().untilAsserted(() -> {
4545
var cm = operator.get(ConfigMap.class, TEST_NAME);
4646
assertThat(cm).isNotNull();

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void updateEventNotReceivedAfterCreateOrUpdate() {
3737
operator.get(CreateUpdateEventFilterTestCustomResource.class,
3838
resource.getMetadata().getName());
3939
actualCreatedResource.getSpec().setValue("2");
40-
operator.replace(actualCreatedResource);
40+
operator.createOrUpdate(actualCreatedResource);
4141

4242
assertData(operator, actualCreatedResource, 2, 2);
4343
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void mapsSecondaryByAnnotation() {
4646
assertThat(configMap.getMetadata().getOwnerReferences()).isEmpty();
4747

4848
configMap.getData().put("additional_data", "data");
49-
operator.replace(configMap);
49+
operator.createOrUpdate(configMap);
5050

5151
await().pollDelay(Duration.ofMillis(150))
5252
.untilAsserted(() -> assertThat(reconciler.getNumberOfExecutions()).isEqualTo(2));

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void testCustomMappingAnnotationForDependent() {
3535
assertConfigMapData(INITIAL_VALUE);
3636

3737
cr.getSpec().setValue(CHANGED_VALUE);
38-
cr = extension.replace(cr);
38+
cr = extension.createOrUpdate(cr);
3939
assertConfigMapData(CHANGED_VALUE);
4040

4141
extension.delete(cr);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void managesCRUDOperationsForDependentInDifferentNamespace() {
3838
});
3939

4040
resource.getSpec().setValue(CHANGED_VALUE);
41-
resource = extension.replace(resource);
41+
resource = extension.createOrUpdate(resource);
4242

4343
await().untilAsserted(() -> {
4444
var cm = getDependentConfigMap();

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void filtersUpdateOnConfigMap() {
3939

4040
var configMap = operator.get(ConfigMap.class, RESOURCE_NAME);
4141
configMap.setData(Map.of(CM_VALUE_KEY, CONFIG_MAP_FILTER_VALUE));
42-
operator.replace(configMap);
42+
operator.createOrUpdate(configMap);
4343

4444
await().pollDelay(Duration.ofMillis(150)).untilAsserted(() -> {
4545
assertThat(operator.getReconcilerOfType(DependentFilterTestReconciler.class)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void reconcileNotTriggeredWithDependentResourceCreateOrUpdate() {
4343
.containsEntry(ConfigMapDependentResource.KEY, SPEC_VAL_1);
4444

4545
resource.getSpec().setValue(SPEC_VAL_2);
46-
operator.replace(resource);
46+
operator.createOrUpdate(resource);
4747

4848
await().pollDelay(Duration.ofSeconds(1)).atMost(Duration.ofSeconds(3))
4949
.until(

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void testMatchingAndUpdate() {
7474
});
7575

7676
resource.getSpec().setValue(CHANGED_VALUE);
77-
extension.replace(resource);
77+
extension.createOrUpdate(resource);
7878

7979
await().untilAsserted(() -> {
8080
var cm = extension.get(ConfigMap.class, TEST_RESOURCE_NAME);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void registersEventSourcesDynamically() {
4343
var cm = extension.get(ConfigMap.class, TEST_RESOURCE_NAME);
4444
cm.getData().put("key2", "val2");
4545

46-
extension.replace(cm); // triggers the reconciliation
46+
extension.createOrUpdate(cm); // triggers the reconciliation
4747

4848
await().untilAsserted(() -> {
4949
assertThat(reconciler.getNumberOfExecutions() - executions).isEqualTo(2);

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ void reconcilesResourceWithPersistentState() throws InterruptedException {
3939
assertResources(resource, INITIAL_TEST_DATA, INITIAL_BULK_SIZE);
4040

4141
resource.getSpec().setData(UPDATED_DATA);
42-
resource = operator.replace(resource);
42+
resource = operator.createOrUpdate(resource);
4343
assertResources(resource, UPDATED_DATA, INITIAL_BULK_SIZE);
4444

4545
resource.getSpec().setNumber(INCREASED_BULK_SIZE);
46-
resource = operator.replace(resource);
46+
resource = operator.createOrUpdate(resource);
4747
assertResources(resource, UPDATED_DATA, INCREASED_BULK_SIZE);
4848

4949
resource.getSpec().setNumber(DECREASED_BULK_SIZE);
50-
resource = operator.replace(resource);
50+
resource = operator.createOrUpdate(resource);
5151
assertResources(resource, UPDATED_DATA, DECREASED_BULK_SIZE);
5252

5353
operator.delete(resource);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void reconcilesResourceWithPersistentState() {
3535
assertResourcesCreated(resource, INITIAL_TEST_DATA);
3636

3737
resource.getSpec().setData(UPDATED_DATA);
38-
operator.replace(resource);
38+
operator.createOrUpdate(resource);
3939
assertResourcesCreated(resource, UPDATED_DATA);
4040

4141
operator.delete(resource);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void reconcilesResourceWithPersistentState() {
2828
assertResourcesCreated(resource, INITIAL_TEST_DATA);
2929

3030
resource.getSpec().setData(UPDATED_DATA);
31-
extension().replace(resource);
31+
extension().createOrUpdate(resource);
3232
assertResourcesCreated(resource, UPDATED_DATA);
3333

3434
extension().delete(resource);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void filtersControllerResourceUpdate() {
3434
.getNumberOfExecutions()).isEqualTo(2));
3535

3636
res.getSpec().setValue(FilterTestReconciler.CUSTOM_RESOURCE_FILTER_VALUE);
37-
operator.replace(res);
37+
operator.createOrUpdate(res);
3838

3939
// not more reconciliation with the filtered value
4040
await().pollDelay(Duration.ofMillis(POLL_DELAY))
@@ -51,7 +51,7 @@ void filtersSecondaryResourceUpdate() {
5151
.getNumberOfExecutions()).isEqualTo(2));
5252

5353
res.getSpec().setValue(CONFIG_MAP_FILTER_VALUE);
54-
operator.replace(res);
54+
operator.createOrUpdate(res);
5555

5656
// the CM event filtered out
5757
await().pollDelay(Duration.ofMillis(POLL_DELAY))

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void testReconciliation() {
3030
});
3131

3232
resource.getSpec().setValue(CHANGED_DATA);
33-
resource = extension().replace(resource);
33+
resource = extension().createOrUpdate(resource);
3434

3535
await().untilAsserted(() -> {
3636
var cm = extension().get(ConfigMap.class, TEST_RESOURCE_NAME);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private void testGracefulStop(String resourceName, int stopTimeout, int expected
4848
});
4949

5050
testRes.getSpec().setValue(2);
51-
operator.replace(testRes);
51+
operator.createOrUpdate(testRes);
5252

5353
await().pollDelay(Duration.ofMillis(50)).untilAsserted(
5454
() -> assertThat(operator.getReconcilerOfType(GracefulStopTestReconciler.class)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void resourcesFoundAndReconciled() {
3939
});
4040

4141
res.getSpec().setValue(CHANGED_SPEC_VALUE);
42-
res = operator.replace(res);
42+
res = operator.createOrUpdate(res);
4343

4444
await().untilAsserted(() -> {
4545
assertThat(reconciler.getNumberOfExecutions()).isEqualTo(2);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void testUsingInformerToWatchChangesOfConfigMap() {
4040
waitForCRStatusValue(INITIAL_STATUS_MESSAGE);
4141

4242
configMap.getData().put(TARGET_CONFIG_MAP_KEY, UPDATE_STATUS_MESSAGE);
43-
operator.replace(configMap);
43+
operator.createOrUpdate(configMap);
4444

4545
waitForCRStatusValue(UPDATE_STATUS_MESSAGE);
4646
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void deletesSecondaryResource() {
6262
});
6363

6464
createdResources.getSpec().setCreateConfigMap(false);
65-
operator.replace(createdResources);
65+
operator.createOrUpdate(createdResources);
6666

6767
await().untilAsserted(() -> {
6868
ConfigMap cm = operator.get(ConfigMap.class, TEST_RESOURCE_NAME);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void resourceNotDeletedUntilDependentDeleted() {
4545

4646
var secret = extension.get(Secret.class, RESOURCE_NAME);
4747
secret.getMetadata().getFinalizers().add(CUSTOM_FINALIZER);
48-
secret = extension.replace(secret);
48+
secret = extension.createOrUpdate(secret);
4949

5050
extension.delete(resource);
5151

@@ -58,7 +58,7 @@ void resourceNotDeletedUntilDependentDeleted() {
5858
});
5959

6060
secret.getMetadata().getFinalizers().clear();
61-
extension.replace(secret);
61+
extension.createOrUpdate(secret);
6262

6363
await().untilAsserted(() -> {
6464
var cm = extension.get(ConfigMap.class, RESOURCE_NAME);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void multiOwnerTriggeringAndManagement() {
4747
});
4848

4949
res1.getSpec().setValue(NEW_VALUE_1);
50-
extension.replace(res1);
50+
extension.createOrUpdate(res1);
5151

5252
await().untilAsserted(() -> {
5353
var cm = extension.get(ConfigMap.class, MultipleOwnerDependentConfigMap.RESOURCE_NAME);
@@ -59,7 +59,7 @@ void multiOwnerTriggeringAndManagement() {
5959
});
6060

6161
res2.getSpec().setValue(NEW_VALUE_2);
62-
extension.replace(res2);
62+
extension.createOrUpdate(res2);
6363

6464
await().untilAsserted(() -> {
6565
var cm = extension.get(ConfigMap.class, MultipleOwnerDependentConfigMap.RESOURCE_NAME);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void handlesCrudOperations() {
3737

3838
var updatedResource = testResource();
3939
updatedResource.getSpec().setValue(UPDATED_SPEC_VALUE);
40-
operator.replace(updatedResource);
40+
operator.createOrUpdate(updatedResource);
4141
assertConfigMapsPresent(UPDATED_SPEC_VALUE);
4242

4343
operator.delete(testResource());

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void handlesCrudOperations() {
3838

3939
var updatedResource = testResource();
4040
updatedResource.getSpec().setValue(UPDATED_SPEC_VALUE);
41-
operator.replace(updatedResource);
41+
operator.createOrUpdate(updatedResource);
4242
assertConfigMapsPresent(UPDATED_SPEC_VALUE);
4343

4444
operator.delete(testResource());

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void handlesExternalCrudOperations() {
3434

3535
var updatedResource = testResource();
3636
updatedResource.getSpec().setValue(UPDATED_SPEC_VALUE);
37-
operator.replace(updatedResource);
37+
operator.createOrUpdate(updatedResource);
3838
assertResourceCreatedWithData(UPDATED_SPEC_VALUE);
3939

4040
operator.delete(testResource());

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private void updateConfigMap(MultipleSecondaryEventSourceCustomResource resource
5151
number == 1 ? MultipleSecondaryEventSourceReconciler.getName1(resource)
5252
: MultipleSecondaryEventSourceReconciler.getName2(resource));
5353
map1.getData().put("value2", "value2");
54-
operator.replace(map1);
54+
operator.createOrUpdate(map1);
5555
}
5656

5757
public MultipleSecondaryEventSourceCustomResource createTestCustomResource() {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void updateEventReceivedAfterCreateOrUpdate() {
3030
operator.get(CreateUpdateEventFilterTestCustomResource.class,
3131
resource.getMetadata().getName());
3232
actualCreatedResource.getSpec().setValue("2");
33-
operator.replace(actualCreatedResource);
33+
operator.createOrUpdate(actualCreatedResource);
3434

3535
CreateUpdateInformerEventSourceEventFilterIT.assertData(operator, actualCreatedResource, 2, 4);
3636
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void testPrimaryToSecondaryInDependentResources() {
4444

4545
cm.setData(Map.of(DATA_KEY, TEST_DATA));
4646
var executions = reconciler.getNumberOfExecutions();
47-
operator.replace(cm);
47+
operator.createOrUpdate(cm);
4848

4949
await().pollDelay(Duration.ofMillis(250)).untilAsserted(() -> {
5050
assertThat(reconciler.getNumberOfExecutions()).isGreaterThan(executions);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void rateLimitsExecution() {
3535
log.debug("replacing resource version: {}", i);
3636
var resource = createResource();
3737
resource.getSpec().setNumber(i);
38-
operator.replace(resource);
38+
operator.createOrUpdate(resource);
3939
});
4040
await().pollInterval(Duration.ofMillis(100))
4141
.pollDelay(Duration.ofMillis(REFRESH_PERIOD / 2))

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void testTheMatchingDoesNoTTriggersFurtherUpdates() {
3434

3535
// make an update to spec to reconcile again
3636
resource.getSpec().setValue(2);
37-
operator.replace(resource);
37+
operator.createOrUpdate(resource);
3838

3939
await().pollDelay(Duration.ofMillis(300)).untilAsserted(() -> {
4040
assertThat(operator.getReconcilerOfType(ServiceStrictMatcherTestReconciler.class)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void specialCRUDReconciler() {
3939
});
4040

4141
resource.getSpec().setValue(CHANGED_VALUE);
42-
extension.replace(resource);
42+
extension.createOrUpdate(resource);
4343

4444
await().untilAsserted(() -> {
4545
var sa = extension.get(ServiceAccount.class, RESOURCE_NAME);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void executeUpdateForTestingCacheUpdateForGetResource() {
5757

5858
var clonedCr = cloner().clone(createdCR);
5959
clonedCr.getSpec().setReplicaCount(2);
60-
operator.replace(clonedCr);
60+
operator.createOrUpdate(clonedCr);
6161

6262
awaitForDeploymentReadyReplicas(2);
6363
assertThat(

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void testSSAMatcher() {
3636
});
3737
// make sure reconciliation happens at least once more
3838
resource.getSpec().setValue("changed value");
39-
extension.replace(resource);
39+
extension.createOrUpdate(resource);
4040

4141
await().untilAsserted(
4242
() -> assertThat(StatefulSetDesiredSanitizerDependentResource.nonMatchedAtLeastOnce)

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void noOptimisticLockingDoneOnStatusUpdate() throws InterruptedException {
3131
var resource = operator.create(createResource());
3232
Thread.sleep(WAIT_TIME / 2);
3333
resource.getMetadata().setAnnotations(Map.of("key", "value"));
34-
operator.replace(resource);
34+
operator.createOrUpdate(resource);
3535

3636
await().pollDelay(Duration.ofMillis(WAIT_TIME)).untilAsserted(() -> {
3737
assertThat(
@@ -59,7 +59,7 @@ void valuesAreDeletedIfSetToNull() {
5959
});
6060

6161
resource.getSpec().setMessageInStatus(false);
62-
operator.replace(resource);
62+
operator.createOrUpdate(resource);
6363

6464
await().untilAsserted(() -> {
6565
var actual = operator.get(StatusPatchLockingCustomResource.class,

0 commit comments

Comments
 (0)