[skip ci]Wait pod ready before 3rd assert (#12455)

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
This commit is contained in:
zhuwenxing 2021-11-30 16:11:24 +08:00 committed by GitHub
parent f00ee2a3b1
commit 8ba15fbd30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -197,17 +197,19 @@ class TestChaos(TestChaosBase):
log.info("chaos deleted")
log.info(f'Alive threads: {threading.enumerate()}')
sleep(2)
# wait all pods ready
log.info(f"wait for pods in namespace {constants.CHAOS_NAMESPACE} with label app.kubernetes.io/instance={meta_name}")
chaos_res.wait_pods_ready(constants.CHAOS_NAMESPACE, f"app.kubernetes.io/instance={meta_name}")
log.info(f"wait for pods in namespace {constants.CHAOS_NAMESPACE} with label release={meta_name}")
chaos_res.wait_pods_ready(constants.CHAOS_NAMESPACE, f"release={meta_name}")
log.info("all pods are ready")
# reconnect if needed
sleep(constants.WAIT_PER_OP * 2)
cc.reconnect(connections, alias='default')
# reset counting again
cc.reset_counting(self.health_checkers)
# wait 50s (varies by feature)
sleep(constants.WAIT_PER_OP * 5)
# assert statistic: all ops success again
log.info("******3rd assert after chaos deleted: ")
assert_statistic(self.health_checkers)

View File

@ -109,10 +109,7 @@ class CustomResourceOperations(object):
api_response = api_instance.list_namespaced_pod(namespace=namespace,label_selector=label_selector)
all_pos_ready_flag = True
for item in api_response.items:
print(item.status.phase)
for c in item.status.container_statuses:
print(c.name)
print(c.ready)
log.info(f"{c.name} statu is {c.ready}")
if c.ready is False:
all_pos_ready_flag = False
@ -125,8 +122,7 @@ class CustomResourceOperations(object):
log.info(f"all pods in namespace {namespace} with label {label_selector} are ready")
else:
log.info("timeout for waiting all pods in namespace {namespace} with label {label_selector} ready")
log.debug(f"list pods response: {api_response}")
except ApiException as e:
log.error("Exception when calling CoreV1Api->list_namespaced_pod: %s\n" % e)
raise Exception(str(e))
return all_pos_ready_flag
return all_pos_ready_flag