Skip to content

Commit 044028b

Browse files
committed
Fixed swallowing python client exceptions in e2e tests
1 parent 4b1ace8 commit 044028b

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

docker/mongodb-kubernetes-tests/kubetester/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ def create_or_update_secret(
4242
api_client: Optional[client.ApiClient] = None,
4343
) -> str:
4444
try:
45-
create_secret(namespace, name, data, type, api_client)
45+
create_secret(namespace, name, data, type, api_client, )
4646
except kubernetes.client.ApiException as e:
4747
if e.status == 409:
4848
update_secret(namespace, name, data, api_client)
49+
else:
50+
raise e
4951

5052
return name
5153

@@ -161,6 +163,8 @@ def create_or_update_service(
161163
update_service(
162164
namespace, service_name, cluster_ip=cluster_ip, ports=ports, selector=selector, service=service
163165
)
166+
else:
167+
raise e
164168
return service_name
165169

166170

@@ -269,6 +273,8 @@ def create_or_update_namespace(
269273
except kubernetes.client.ApiException as e:
270274
if e.status == 409:
271275
client.CoreV1Api(api_client=api_client).patch_namespace(namespace, namespace_resource)
276+
else:
277+
raise e
272278

273279

274280
def delete_namespace(name: str):

docker/mongodb-kubernetes-tests/kubetester/kubetester.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ def create_or_update_pvc(
303303
cls.clients("corev1", api_client=api_client).patch_namespaced_persistent_volume_claim(
304304
body=body, name=body["metadata"]["name"], namespace=namespace
305305
)
306+
else:
307+
raise e
306308

307309
@classmethod
308310
def delete_pvc(cls, namespace: str, name: str):

docker/mongodb-kubernetes-tests/tests/olm/olm_meko_operator_upgrade_with_resources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,8 @@ def update_subscription() -> bool:
379379
except kubernetes.client.ApiException as e:
380380
if e.status == 409:
381381
return False
382-
else:
383-
raise e
382+
else:
383+
raise e
384384

385385
run_periodically(update_subscription, timeout=100, msg="Subscription to be updated")
386386

docker/mongodb-kubernetes-tests/tests/olm/olm_operator_upgrade_with_resources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ def update_subscription() -> bool:
363363
except kubernetes.client.ApiException as e:
364364
if e.status == 409:
365365
return False
366-
else:
367-
raise e
366+
else:
367+
raise e
368368

369369
run_periodically(update_subscription, timeout=100, msg="Subscription to be updated")
370370

0 commit comments

Comments
 (0)