Skip to content

Commit

Permalink
Retry fetching Noobaa endpoint pods data in case of KeyError (red-hat…
Browse files Browse the repository at this point in the history
…-storage#3247)

* Retry fetching Noobaa endpoint pods data

Signed-off-by: Elad Ben Aharon <ebenahar@redhat.com>

fix

Signed-off-by: Elad Ben Aharon <ebenahar@redhat.com>

fix

Signed-off-by: Elad Ben Aharon <ebenahar@redhat.com>

fix

Signed-off-by: Elad Ben Aharon <ebenahar@redhat.com>

fix

Signed-off-by: Elad Ben Aharon <ebenahar@redhat.com>

* Address comments

Signed-off-by: Elad Ben Aharon <ebenahar@redhat.com>
  • Loading branch information
ebenahar authored and prsurve committed Feb 5, 2021
1 parent 8242d3b commit 0061147
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3007,8 +3007,10 @@ def get_ready_noobaa_endpoint_count(namespace):
pods_info = get_pods_having_label(label=constants.NOOBAA_ENDPOINT_POD_LABEL, namespace=namespace)
ready_count = 0
for ep_info in pods_info:
if ep_info['status']['containerStatuses'][0]['ready']:
ready_count += 1
container_statuses = ep_info.get('status', {}).get('containerStatuses')
if container_statuses is not None and len(container_statuses) > 0:
if container_statuses[0].get('ready'):
ready_count += 1
return ready_count


Expand All @@ -3029,7 +3031,6 @@ def nb_ensure_endpoint_count(request):
if float(config.ENV_DATA['ocs_version']) < 4.6:
noobaa = OCP(kind='noobaa', namespace=namespace)
resource = noobaa.get()['items'][0]
resource_name = resource['metadata']['name']
endpoints = resource.get('spec', {}).get('endpoints', {})

if endpoints.get('minCount', -1) != min_ep_count:
Expand Down

0 comments on commit 0061147

Please sign in to comment.