def test_get_one_namespace(self): res = k8s.get_namespaces("default", apiserver_url="http://127.0.0.1:8080") a = res.get("metadata", {}).get("name", "a") proc = Popen(["kubectl", "get", "namespaces", "default", "-o", "json"], stdout=PIPE) kubectl_out = salt.utils.json.loads(proc.communicate()[0]) b = kubectl_out.get("metadata", {}).get("name", "b") self.assertEqual(a, b)
def test_get_one_namespace(self): res = k8s.get_namespaces("default", apiserver_url="http://127.0.0.1:8080") a = res.get("metadata", {}).get("name", "a") proc = Popen(["kubectl", "get", "namespaces", "default", "-o", "json"], stdout=PIPE) kubectl_out = json.loads(proc.communicate()[0]) b = kubectl_out.get("metadata", {}).get("name", "b") self.assertEqual(a, b)
def test_get_namespaces(self): res = k8s.get_namespaces(apiserver_url="http://127.0.0.1:8080") a = len(res.get("items")) proc = Popen(["kubectl", "get", "namespaces", "-o", "json"], stdout=PIPE) kubectl_out = salt.utils.json.loads(proc.communicate()[0]) b = len(kubectl_out.get("items")) self.assertEqual(a, b)
def test_get_namespaces(self): res = k8s.get_namespaces(apiserver_url="http://127.0.0.1:8080") a = len(res.get("items")) proc = Popen(["kubectl", "get", "namespaces", "-o", "json"], stdout=PIPE) kubectl_out = json.loads(proc.communicate()[0]) b = len(kubectl_out.get("items")) self.assertEqual(a, b)