File tree Expand file tree Collapse file tree 2 files changed +4
-24
lines changed
docker/mongodb-kubernetes-tests Expand file tree Collapse file tree 2 files changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,8 @@ def create(self) -> CustomObject:
116116
117117 def update (self ) -> CustomObject :
118118 """Updates the object in Kubernetes. Deleting keys is done by setting them to None"""
119- return create_or_update (self )
119+ self .patch ()
120+ return self
120121
121122 def patch (self , field_manager : str = "e2e-tests" ) -> CustomObject :
122123 """Apply the object in Kubernetes using server-side apply.
@@ -326,26 +327,3 @@ def get_crd_names(
326327
327328 if found :
328329 return crd
329-
330-
331- def create_or_update (resource : CustomObject ) -> CustomObject :
332- """
333- Tries to create the resource. If resource already exists (resulting in 409 Conflict),
334- then it updates it instead using server-side apply.
335-
336- Server-side apply (SSA) with force=True handles conflicts automatically by taking
337- ownership of conflicting fields, eliminating the need for client-side merge retries.
338- """
339- if not resource .bound :
340- try :
341- resource .create ()
342- except client .ApiException as e :
343- if e .status != 409 :
344- raise e
345- # Resource already exists, use SSA to update it
346- resource .patch ()
347- else :
348- # SSA with force=True handles conflicts automatically
349- resource .patch ()
350-
351- return resource
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ def _server_side_apply(
6666 )
6767
6868 return result .to_dict ()
69+
70+
6971from tests import test_logger
7072
7173TRACER = trace .get_tracer ("evergreen-agent" )
You can’t perform that action at this time.
0 commit comments