Skip to content

Commit

Permalink
fix operator phase check (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebattat authored Nov 15, 2023
1 parent 17d7fc5 commit 402ba7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions benchmark_runner/common/oc/oc.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,14 @@ def wait_for_dv_status(self,
current_wait_time += OC.SLEEP_TIME
raise DVStatusTimeout(status=status)

def verify_odf_installation(self):
def verify_odf_installation(self, namespace='openshift-storage'):
"""
This method verifies ODF installation
:return: True ODF passed, False failed
"""
self.run(""" oc patch storagecluster ocs-storagecluster -n openshift-storage --type json --patch '[{ "op": "replace", "path": "/spec/enableCephTools", "value": true }]' """)
rook_ceph_tools_pod = self._get_pod_name(pod_name='rook-ceph-tools', namespace='openshift-storage')
self.run(f"oc patch storagecluster ocs-storagecluster -n {namespace} --type json --patch '[{{ \"op\": \"replace\", \"path\": \"/spec/enableCephTools\", \"value\": true }}]'")
rook_ceph_tools_pod = self._get_pod_name(pod_name='rook-ceph-tools', namespace=namespace)
self.wait_for_pod_create(pod_name=rook_ceph_tools_pod, namespace=namespace, timeout=self.timeout)
result = self.run(f"oc -n openshift-storage rsh {rook_ceph_tools_pod} ceph health")
return 'HEALTH_OK' == result.strip()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ def apply_patch(self, namespace: str, resource: str):
check_approved = f"oc get InstallPlan -n {namespace} {name} -ojsonpath={{..spec.approved}}"
approved = self.__oc.run(cmd=check_approved)
# APPROVED false - need to patch
if not approved:
if not {'true': True, 'false': False}.get(approved.lower(), False):
install_plan_cmd = (f"oc patch InstallPlan -n {namespace} {name} -p '{{\"spec\":{{\"approved\":true}}}}' --type merge")
self.__oc.run(cmd=install_plan_cmd)
# verify current status
result = self.__oc.run(cmd=check_approved)
if result == 'true':
if {'true': True, 'false': False}.get(result.lower(), False):
if resource == 'odf':
# Check status for each CSV name
csv_names = self.__oc.run(f"oc get csv -n {namespace} -ojsonpath={{$.items[*].metadata.name}}")
Expand Down

0 comments on commit 402ba7c

Please sign in to comment.