Last active
June 24, 2018 02:33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_to_list_endpoints_for_all_namespaces(k8s_client): | |
ret = k8s_client.list_endpoints_for_all_namespaces() | |
epcount = len(ret.items) | |
print(epcount) | |
assert(epcount > 0) | |
# Iterate through all the endpoints in the K8s cluster and list it down | |
for item in ret.items: | |
print("%s\t%s\t" % (item.metadata.name, item.metadata.namespace)) | |
def test_to_list_services_for_all_namespaces(k8s_client): | |
ret = k8s_client.list_service_for_all_namespaces() | |
print("\n") | |
svccount = len(ret.items) | |
print(svccount) | |
assert(svccount > 0) | |
# Iterate through all the services in the K8s cluster and list down all the services and respective namespace | |
for item in ret.items: | |
print("%s\t%s\t" % (item.metadata.name, item.metadata.namespace)) | |
def test_to_list_nodes_for_all_namespaces(k8s_client): | |
ret = k8s_client.list_node() | |
nodecount = len(ret.items) | |
print(nodecount) | |
assert(nodecount > 0) | |
# Iterate through all the nodes in the K8s cluster and list it down | |
for item in ret.items: | |
print("%s\t" % item.metadata.name) | |
def test_to_list_pods_for_all_namespaces(k8s_client): | |
ret = k8s_client.list_pod_for_all_namespaces() | |
podcount = len(ret.items) | |
print(podcount) | |
assert(podcount > 0) | |
# Iterate through all the pods in the K8s cluster and list down the pod name and respective namespace | |
for item in ret.items: | |
print("%s\t%s\t" % (item.metadata.name, item.metadata.namespace)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment