Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save samirbehara-zz/8b09a362ee843ee24bdf971607dcc9d7 to your computer and use it in GitHub Desktop.
Save samirbehara-zz/8b09a362ee843ee24bdf971607dcc9d7 to your computer and use it in GitHub Desktop.
def test_kubernetes_pod_status_is_running(k8s_client):
podlist = k8s_client.list_namespaced_pod("default")
# Iterate through all the pods in the default namespace and verify that they are Running
for item in podlist.items:
pod = k8s_client.read_namespaced_pod_status(namespace='default', name=item.metadata.name)
print("%s\t%s\t" % (item.metadata.name, item.metadata.namespace))
print(pod.status.phase)
assert(pod.status.phase == "Running" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment