예제 #1
0
 def test_create_namespace(self):
     hash = hashlib.sha1()
     hash.update(str(time.time()))
     nsname = hash.hexdigest()[:16]
     res = k8s.create_namespace(nsname, apiserver_url="http://127.0.0.1:8080")
     proc = Popen(["kubectl", "get", "namespaces", nsname, "-o", "json"], stdout=PIPE)
     kubectl_out = salt.utils.json.loads(proc.communicate()[0])
     # if creation is failed, kubernetes return non json error message
     self.assertTrue(isinstance(kubectl_out, dict))
예제 #2
0
 def test_create_namespace(self):
     hash = hashlib.sha1()
     hash.update(str(time.time()))
     nsname = hash.hexdigest()[:16]
     res = k8s.create_namespace(nsname, apiserver_url="http://127.0.0.1:8080")
     proc = Popen(["kubectl", "get", "namespaces", nsname, "-o", "json"], stdout=PIPE)
     kubectl_out = json.loads(proc.communicate()[0])
     # if creation is failed, kubernetes return non json error message
     self.assertTrue(isinstance(kubectl_out, dict))