Skip to content

Commit e954a6e

Browse files
committed
testing: watsonx-serving: add crds and namespaces to delete for each of the depency operators
1 parent de93de0 commit e954a6e

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

testing/watsonx-serving/config.yaml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,18 +268,36 @@ rhods:
268268

269269
prepare:
270270
operators:
271-
- name: servicemeshoperator
272-
catalog: redhat-operators
273-
namespace: all
274271
- name: kiali-ossm
275272
catalog: redhat-operators
276273
namespace: all
274+
cleanup:
275+
crds:
276+
- kialis.kiali.io
277277
- name: jaeger-product
278278
catalog: redhat-operators
279279
namespace: all
280+
cleanup:
281+
crds:
282+
- jaegers.jaegertracing.io
280283
- name: serverless-operator
281284
catalog: redhat-operators
282285
namespace: all
286+
cleanup:
287+
crds:
288+
- knativeservings.operator.knative.dev
289+
namespaces:
290+
- knative-eventing
291+
- knative-serving
292+
- name: servicemeshoperator
293+
catalog: redhat-operators
294+
namespace: all
295+
cleanup:
296+
crds:
297+
- servicemeshmemberrolls.maistra.io
298+
- servicemeshcontrolplanes.maistra.io
299+
namespaces:
300+
- istio-system
283301

284302
base_image:
285303
namespace: watsonx-serving-user-test-driver

testing/watsonx-serving/prepare_watsonx_serving.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,29 @@ def prepare():
6464
def undeploy_operator(operator):
6565
manifest_name = operator["name"]
6666
namespace = operator["namespace"]
67+
if namespace == "all":
68+
namespace = "openshift-operators"
6769

68-
installed_csv_cmd = run.run(f"oc get csv -oname -n {namespace}", capture_stdout=True)
69-
if manifest_name not in installed_csv_cmd.stdout:
70+
cleanup = operator.get("cleanup", dict(crds=[], namespaces=[]))
71+
72+
for crd in cleanup.get("crds", []):
73+
run.run(f"oc delete {crd} --all -A")
74+
75+
installed_csv_cmd = run.run(f"oc get csv -oname -n {namespace} -loperators.coreos.com/{manifest_name}.{namespace}", capture_stdout=True)
76+
if not installed_csv_cmd.stdout:
7077
logging.info(f"{manifest_name} operator is not installed")
71-
return
7278

73-
run.run(f"oc delete sub/{manifest_name} -n {namespace}")
79+
run.run(f"oc delete sub/{manifest_name} -n {namespace} --ignore-not-found")
7480
run.run(f"oc delete csv -n {namespace} -loperators.coreos.com/{manifest_name}.{namespace}")
7581

82+
for crd in cleanup.get("crds", []):
83+
run.run(f"oc delete crd/{crd} --ignore-not-found")
84+
85+
for ns in cleanup.get("namespaces", []):
86+
run.run(f"oc api-resources --verbs=list --namespaced -o name | xargs -t -n 1 oc get --show-kind --ignore-not-found -n watsonx-serving-user-test-driver > $ARTIFACT_DIR/{operator['name']}_{ns}.log", check=False)
87+
run.run(f"oc delete ns {ns} --wait=False --ignore-not-found")
88+
89+
7690

7791
def cleanup():
7892
rhods.uninstall()

0 commit comments

Comments
 (0)