Ejemplo n.º 1
0
 def test_delete(self):
     name = "yo-{0}".format(str(uuid.uuid4().get_hex()[:16]))
     svc = utils.create_service(name=name)
     svc.add_port(name="redis", port=5432, target_port=5432, protocol="tcp")
     if utils.is_reachable(svc.config.api_host):
         svc.create()
         from_get = K8sService.get_by_name(svc.config, svc.name)
         self.assertIsInstance(from_get, list)
         self.assertIn(svc, from_get)
         svc.delete()
         from_get = K8sService.get_by_name(svc.config, svc.name)
         self.assertNotIn(svc, from_get)
Ejemplo n.º 2
0
 def test_delete(self):
     name = "yo-{0}".format(str(uuid.uuid4().hex[:16]))
     svc = _utils.create_service(name=name)
     svc.add_port(name="redis", port=5432, target_port=5432, protocol="tcp")
     if _utils.is_reachable(svc.config):
         svc.create()
         from_get = K8sService.get_by_name(svc.config, svc.name)
         self.assertIsInstance(from_get, list)
         self.assertIn(svc, from_get)
         svc.delete()
         from_get = K8sService.get_by_name(svc.config, svc.name)
         self.assertNotIn(svc, from_get)
Ejemplo n.º 3
0
 def test_get_by_name_nonexistent(self):
     name = "yo-{0}".format(str(uuid.uuid4().get_hex()[:16]))
     svc = utils.create_service(name=name)
     svc.add_port(name="redis", port=5432, target_port=5432, protocol="tcp")
     if utils.is_reachable(svc.config.api_host):
         _list = K8sService.get_by_name(config=svc.config, name=name)
         self.assertIsInstance(_list, list)
         self.assertEqual(0, len(_list))
Ejemplo n.º 4
0
 def test_get_by_name_nonexistent(self):
     name = "yo-{0}".format(str(uuid.uuid4().hex[:16]))
     svc = _utils.create_service(name=name)
     svc.add_port(name="redis", port=5432, target_port=5432, protocol="tcp")
     if _utils.is_reachable(svc.config):
         _list = K8sService.get_by_name(config=svc.config, name=name)
         self.assertIsInstance(_list, list)
         self.assertEqual(0, len(_list))
Ejemplo n.º 5
0
 def test_get_by_name(self):
     name = "yo-{0}".format(str(uuid.uuid4().hex[:16]))
     svc = _utils.create_service(name=name)
     svc.add_port(name="redis", port=5432, target_port=5432, protocol="tcp")
     if _utils.is_reachable(svc.config):
         svc.create()
         _list = K8sService.get_by_name(config=svc.config, name=name)
         self.assertIsInstance(_list, list)
         self.assertEqual(1, len(_list))
         from_get = _list[0]
         self.assertIsInstance(from_get, K8sService)
         self.assertEqual(from_get, svc)
Ejemplo n.º 6
0
 def test_get_by_name(self):
     name = "yo-{0}".format(unicode(uuid.uuid4().get_hex()[:16]))
     svc = utils.create_service(name=name)
     svc.add_port(name="redis", port=5432, target_port=5432, protocol="tcp")
     if utils.is_reachable(svc.config.api_host):
         svc.create()
         _list = K8sService.get_by_name(config=svc.config, name=name)
         self.assertIsInstance(_list, list)
         self.assertEqual(1, len(_list))
         from_get = _list[0]
         self.assertIsInstance(from_get, K8sService)
         self.assertEqual(from_get, svc)