Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ecb1112

Browse files
committedMar 12, 2024
fix IT
Signed-off-by: Attila Mészáros <csviri@gmail.com>
1 parent 02a0fe6 commit ecb1112

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

Diff for: ‎operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcher.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.javaoperatorsdk.operator.processing.event;
22

3-
import java.util.Collections;
43
import java.util.function.Function;
54

65
import org.slf4j.Logger;
@@ -421,7 +420,7 @@ public R patchStatus(R resource, R originalResource) {
421420
var managedFields = resource.getMetadata().getManagedFields();
422421
try {
423422

424-
resource.getMetadata().setManagedFields(Collections.emptyList());
423+
resource.getMetadata().setManagedFields(null);
425424
var res = resource(resource);
426425
return res.subresource("status").patch(new PatchContext.Builder()
427426
.withFieldManager(fieldManager)

Diff for: ‎operator-framework/src/test/java/io/javaoperatorsdk/operator/StatusPatchNotLockingIT.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void noOptimisticLockingDoneOnStatusUpdate() throws InterruptedException {
4848

4949
// see https://github.com/fabric8io/kubernetes-client/issues/4158
5050
@Test
51-
void valuesAreDeletedIfSetToNull() {
51+
void valuesAreDeletedIfSetToNull() throws InterruptedException {
5252
var resource = operator.create(createResource());
5353

5454
await().untilAsserted(() -> {
@@ -58,10 +58,12 @@ void valuesAreDeletedIfSetToNull() {
5858
assertThat(actual.getStatus().getMessage()).isEqualTo(MESSAGE);
5959
});
6060

61+
// resource needs to be read again to we don't replace the with wrong managed fields
62+
resource = operator.get(StatusPatchLockingCustomResource.class, TEST_RESOURCE_NAME);
6163
resource.getSpec().setMessageInStatus(false);
6264
operator.replace(resource);
6365

64-
await().untilAsserted(() -> {
66+
await().timeout(Duration.ofMinutes(3)).untilAsserted(() -> {
6567
var actual = operator.get(StatusPatchLockingCustomResource.class,
6668
TEST_RESOURCE_NAME);
6769
assertThat(actual.getStatus()).isNotNull();

0 commit comments

Comments
 (0)
Please sign in to comment.