Skip to content

fix: remove deprecated api #842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public R updateStatus(R resource) {
return resourceOperation
.inNamespace(resource.getMetadata().getNamespace())
.withName(getName(resource))
.updateStatus(resource);
.replaceStatus(resource);
}

public R replaceWithLock(R resource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,13 @@ void ifNoFinalizerPresentFirstAddsTheFinalizerThenExecutesControllerAgain() {
}

/**
* Not that here status sub-resource update will fail on optimistic locking. This solves a tricky
* situation: If this would not happen (no optimistic locking on status sub-resource) we could
* receive and store an event while processing the controller method. But this event would always
* fail since its resource version is outdated already.
* The update status actually does optimistic locking in the background but fabric8 client retries
* it with an up-to-date resource version.
*/
@Test
void updateCustomResourceAfterSubResourceChange() {
SubResourceTestCustomResource resource = createTestCustomResource("1");
operator.create(SubResourceTestCustomResource.class, resource);
resource = operator.create(SubResourceTestCustomResource.class, resource);

// waits for the resource to start processing
waitXms(EVENT_RECEIVE_WAIT);
Expand All @@ -89,9 +87,9 @@ void updateCustomResourceAfterSubResourceChange() {

// wait for sure, there are no more events
waitXms(WAIT_AFTER_EXECUTION);
// there is no event on status update processed
assertThat(TestUtils.getNumberOfExecutions(operator))
.isEqualTo(3);
// note that both is valid, since after the update of the status the event receive lags,
// that will result in a third execution
assertThat(TestUtils.getNumberOfExecutions(operator)).isBetween(2, 3);
}

void awaitStatusUpdated(String name) {
Expand Down