@@ -133,7 +133,7 @@ void addFinalizerOnNewResource() {
133133 verify (reconciler , never ())
134134 .reconcile (ArgumentMatchers .eq (testCustomResource ), any ());
135135 verify (customResourceFacade , times (1 ))
136- .replaceResourceWithLock (
136+ .updateResource (
137137 argThat (testCustomResource -> testCustomResource .hasFinalizer (DEFAULT_FINALIZER )));
138138 assertThat (testCustomResource .hasFinalizer (DEFAULT_FINALIZER )).isTrue ();
139139 }
@@ -155,20 +155,20 @@ void updatesOnlyStatusSubResourceIfFinalizerSet() {
155155 reconciliationDispatcher .handleExecution (executionScopeWithCREvent (testCustomResource ));
156156
157157 verify (customResourceFacade , times (1 )).patchStatus (eq (testCustomResource ), any ());
158- verify (customResourceFacade , never ()).replaceResourceWithLock (any ());
158+ verify (customResourceFacade , never ()).updateResource (any ());
159159 }
160160
161161 @ Test
162162 void updatesBothResourceAndStatusIfFinalizerSet () {
163163 testCustomResource .addFinalizer (DEFAULT_FINALIZER );
164164
165165 reconciler .reconcile = (r , c ) -> UpdateControl .updateResourceAndStatus (testCustomResource );
166- when (customResourceFacade .replaceResourceWithLock (testCustomResource ))
166+ when (customResourceFacade .updateResource (testCustomResource ))
167167 .thenReturn (testCustomResource );
168168
169169 reconciliationDispatcher .handleExecution (executionScopeWithCREvent (testCustomResource ));
170170
171- verify (customResourceFacade , times (1 )).replaceResourceWithLock (testCustomResource );
171+ verify (customResourceFacade , times (1 )).updateResource (testCustomResource );
172172 verify (customResourceFacade , times (1 )).updateStatus (testCustomResource );
173173 }
174174
@@ -182,7 +182,7 @@ void patchesStatus() {
182182
183183 verify (customResourceFacade , times (1 )).patchStatus (eq (testCustomResource ), any ());
184184 verify (customResourceFacade , never ()).updateStatus (any ());
185- verify (customResourceFacade , never ()).replaceResourceWithLock (any ());
185+ verify (customResourceFacade , never ()).updateResource (any ());
186186 }
187187
188188 @ Test
@@ -214,7 +214,7 @@ void removesDefaultFinalizerOnDeleteIfSet() {
214214 reconciliationDispatcher .handleExecution (executionScopeWithCREvent (testCustomResource ));
215215
216216 assertThat (postExecControl .isFinalizerRemoved ()).isTrue ();
217- verify (customResourceFacade , times (1 )).replaceResourceWithLock (testCustomResource );
217+ verify (customResourceFacade , times (1 )).updateResource (testCustomResource );
218218 }
219219
220220 @ Test
@@ -223,7 +223,7 @@ void retriesFinalizerRemovalWithFreshResource() {
223223 markForDeletion (testCustomResource );
224224 var resourceWithFinalizer = TestUtils .testCustomResource ();
225225 resourceWithFinalizer .addFinalizer (DEFAULT_FINALIZER );
226- when (customResourceFacade .replaceResourceWithLock (testCustomResource ))
226+ when (customResourceFacade .updateResource (testCustomResource ))
227227 .thenThrow (new KubernetesClientException (null , 409 , null ))
228228 .thenReturn (testCustomResource );
229229 when (customResourceFacade .getResource (any (), any ())).thenReturn (resourceWithFinalizer );
@@ -232,15 +232,15 @@ void retriesFinalizerRemovalWithFreshResource() {
232232 reconciliationDispatcher .handleExecution (executionScopeWithCREvent (testCustomResource ));
233233
234234 assertThat (postExecControl .isFinalizerRemoved ()).isTrue ();
235- verify (customResourceFacade , times (2 )).replaceResourceWithLock (any ());
235+ verify (customResourceFacade , times (2 )).updateResource (any ());
236236 verify (customResourceFacade , times (1 )).getResource (any (), any ());
237237 }
238238
239239 @ Test
240240 void throwsExceptionIfFinalizerRemovalRetryExceeded () {
241241 testCustomResource .addFinalizer (DEFAULT_FINALIZER );
242242 markForDeletion (testCustomResource );
243- when (customResourceFacade .replaceResourceWithLock (any ()))
243+ when (customResourceFacade .updateResource (any ()))
244244 .thenThrow (new KubernetesClientException (null , 409 , null ));
245245 when (customResourceFacade .getResource (any (), any ()))
246246 .thenAnswer ((Answer <TestCustomResource >) invocationOnMock -> createResourceWithFinalizer ());
@@ -252,7 +252,7 @@ void throwsExceptionIfFinalizerRemovalRetryExceeded() {
252252 assertThat (postExecControl .getRuntimeException ()).isPresent ();
253253 assertThat (postExecControl .getRuntimeException ().get ())
254254 .isInstanceOf (OperatorException .class );
255- verify (customResourceFacade , times (MAX_FINALIZER_REMOVAL_RETRY )).replaceResourceWithLock (any ());
255+ verify (customResourceFacade , times (MAX_FINALIZER_REMOVAL_RETRY )).updateResource (any ());
256256 verify (customResourceFacade , times (MAX_FINALIZER_REMOVAL_RETRY - 1 )).getResource (any (),
257257 any ());
258258 }
@@ -261,15 +261,15 @@ void throwsExceptionIfFinalizerRemovalRetryExceeded() {
261261 void throwsExceptionIfFinalizerRemovalClientExceptionIsNotConflict () {
262262 testCustomResource .addFinalizer (DEFAULT_FINALIZER );
263263 markForDeletion (testCustomResource );
264- when (customResourceFacade .replaceResourceWithLock (any ()))
264+ when (customResourceFacade .updateResource (any ()))
265265 .thenThrow (new KubernetesClientException (null , 400 , null ));
266266
267267 var res =
268268 reconciliationDispatcher .handleExecution (executionScopeWithCREvent (testCustomResource ));
269269
270270 assertThat (res .getRuntimeException ()).isPresent ();
271271 assertThat (res .getRuntimeException ().get ()).isInstanceOf (KubernetesClientException .class );
272- verify (customResourceFacade , times (1 )).replaceResourceWithLock (any ());
272+ verify (customResourceFacade , times (1 )).updateResource (any ());
273273 verify (customResourceFacade , never ()).getResource (any (), any ());
274274 }
275275
@@ -315,7 +315,7 @@ void doesNotRemovesTheSetFinalizerIfTheDeleteNotMethodInstructsIt() {
315315 reconciliationDispatcher .handleExecution (executionScopeWithCREvent (testCustomResource ));
316316
317317 assertEquals (1 , testCustomResource .getMetadata ().getFinalizers ().size ());
318- verify (customResourceFacade , never ()).replaceResourceWithLock (any ());
318+ verify (customResourceFacade , never ()).updateResource (any ());
319319 }
320320
321321 @ Test
@@ -325,21 +325,21 @@ void doesNotUpdateTheResourceIfNoUpdateUpdateControlIfFinalizerSet() {
325325 reconciler .reconcile = (r , c ) -> UpdateControl .noUpdate ();
326326
327327 reconciliationDispatcher .handleExecution (executionScopeWithCREvent (testCustomResource ));
328- verify (customResourceFacade , never ()).replaceResourceWithLock (any ());
328+ verify (customResourceFacade , never ()).updateResource (any ());
329329 verify (customResourceFacade , never ()).updateStatus (testCustomResource );
330330 }
331331
332332 @ Test
333333 void addsFinalizerIfNotMarkedForDeletionAndEmptyCustomResourceReturned () {
334334 removeFinalizers (testCustomResource );
335335 reconciler .reconcile = (r , c ) -> UpdateControl .noUpdate ();
336- when (customResourceFacade .replaceResourceWithLock (any ())).thenReturn (testCustomResource );
336+ when (customResourceFacade .updateResource (any ())).thenReturn (testCustomResource );
337337
338338 var postExecControl =
339339 reconciliationDispatcher .handleExecution (executionScopeWithCREvent (testCustomResource ));
340340
341341 assertEquals (1 , testCustomResource .getMetadata ().getFinalizers ().size ());
342- verify (customResourceFacade , times (1 )).replaceResourceWithLock (any ());
342+ verify (customResourceFacade , times (1 )).updateResource (any ());
343343 assertThat (postExecControl .updateIsStatusPatch ()).isFalse ();
344344 assertThat (postExecControl .getUpdatedCustomResource ()).isPresent ();
345345 }
@@ -351,7 +351,7 @@ void doesNotCallDeleteIfMarkedForDeletionButNotOurFinalizer() {
351351
352352 reconciliationDispatcher .handleExecution (executionScopeWithCREvent (testCustomResource ));
353353
354- verify (customResourceFacade , never ()).replaceResourceWithLock (any ());
354+ verify (customResourceFacade , never ()).updateResource (any ());
355355 verify (reconciler , never ()).cleanup (eq (testCustomResource ), any ());
356356 }
357357
@@ -475,7 +475,7 @@ void updateObservedGenerationOnCustomResourceUpdate() throws Exception {
475475 when (config .isGenerationAware ()).thenReturn (true );
476476 when (reconciler .reconcile (any (), any ()))
477477 .thenReturn (UpdateControl .updateResource (observedGenResource ));
478- when (facade .replaceResourceWithLock (any ())).thenReturn (observedGenResource );
478+ when (facade .updateResource (any ())).thenReturn (observedGenResource );
479479 when (facade .updateStatus (observedGenResource )).thenReturn (observedGenResource );
480480 var dispatcher = init (observedGenResource , reconciler , config , facade , true );
481481
0 commit comments