• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python _utils.create_service函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests._utils.create_service函数的典型用法代码示例。如果您正苦于以下问题:Python create_service函数的具体用法?Python create_service怎么用?Python create_service使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create_service函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_delete_nonexistent

 def test_delete_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):
         with self.assertRaises(NotFoundException):
             svc.delete()
开发者ID:froch,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例2: test_get_label

 def test_get_label(self):
     name = "yoservice"
     svc = _utils.create_service(name=name)
     k = "yokey"
     v = "yovalue"
     svc.add_label(k, v)
     self.assertEqual(v, svc.get_label(k))
开发者ID:froch,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例3: test_add_label_invalid_args

 def test_add_label_invalid_args(self):
     name = "yoservice"
     svc = _utils.create_service(name=name)
     k = object()
     v = object()
     with self.assertRaises(SyntaxError):
         svc.add_label(k, v)
开发者ID:froch,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例4: test_get_annotation

 def test_get_annotation(self):
     name = "yoservice"
     svc = _utils.create_service(name=name)
     k = "yokey"
     v_in = "yovalue"
     svc.add_annotation(k, v_in)
     v_out = svc.get_annotation(k)
     self.assertEqual(v_in, v_out)
开发者ID:froch,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py


示例5: test_get_by_name_nonexistent

 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))
开发者ID:froch,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py


示例6: test_add_annotation_none_args

 def test_add_annotation_none_args(self):
     name = "yoservice"
     svc = _utils.create_service(name=name)
     try:
         svc.add_annotation()
         self.fail("Should not fail.")
     except Exception as err:
         self.assertIsInstance(err, SyntaxError)
开发者ID:froch,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py


示例7: test_add_annotation

 def test_add_annotation(self):
     name = "yoservice"
     svc = _utils.create_service(name=name)
     k = "yokey"
     v = "yovalue"
     svc.add_annotation(k, v)
     self.assertIn(k, svc.annotations)
     self.assertEqual(v, svc.annotations[k])
开发者ID:froch,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py


示例8: test_update_nothing_changed

 def test_update_nothing_changed(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):
         from_create = svc.create()
         from_update = svc.update()
         self.assertEqual(from_create, from_update)
开发者ID:froch,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py


示例9: test_struct_service

 def test_struct_service(self):
     name = "yoname"
     svc = _utils.create_service(name=name)
     self.assertIsInstance(svc, K8sService)
     self.assertIsInstance(svc.model, Service)
     self.assertIsInstance(svc.model.metadata, ObjectMeta)
     self.assertIsInstance(svc.model.spec, ServiceSpec)
     self.assertIsInstance(svc.model.status, ServiceStatus)
开发者ID:froch,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py


示例10: test_init_with_name

 def test_init_with_name(self):
     name = "yoname"
     svc = _utils.create_service(name=name)
     self.assertIsNotNone(svc)
     self.assertIsInstance(svc, K8sService)
     self.assertEqual('Service', svc.obj_type)
     self.assertEqual(svc.name, name)
     self.assertIsInstance(svc.config, K8sConfig)
开发者ID:froch,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py


示例11: test_create_already_exists

 def test_create_already_exists(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()
         with self.assertRaises(UnprocessableEntityException):
             svc.create()
开发者ID:froch,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py


示例12: test_create

 def test_create(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 = svc.get()
         self.assertEqual(svc, from_get)
开发者ID:froch,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py


示例13: test_update_set_cluster_ip_fails

 def test_update_set_cluster_ip_fails(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()
         svc.cluster_ip = "192.168.123.123"
         with self.assertRaises(UnprocessableEntityException):
             svc.update()
开发者ID:froch,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_service.py


示例14: test_struct_k8s_service

 def test_struct_k8s_service(self):
     name = "yoname"
     svc = _utils.create_service(name=name)
     self.assertIsInstance(svc, K8sService)
     self.assertIsInstance(svc.base_url, str)
     self.assertIsInstance(svc.config, K8sConfig)
     self.assertIsInstance(svc.model, Service)
     self.assertIsInstance(svc.name, str)
     self.assertIsInstance(svc.obj_type, str)
开发者ID:froch,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_service.py


示例15: test_set_cluster_ip_invalid_ip_address

 def test_set_cluster_ip_invalid_ip_address(self):
     name = "yoservice"
     svc = _utils.create_service(name=name)
     svc.add_port('http', 80, 80, 'TCP')
     if _utils.is_reachable(svc.config):
         svc.create()
         ip = "192.168.00000.1234345"
         svc.cluster_ip = ip
         with self.assertRaises(UnprocessableEntityException):
             svc.update()
开发者ID:froch,项目名称:kubernetes-py,代码行数:10,代码来源:test_k8s_service.py


示例16: test_update_set_external_ips

 def test_update_set_external_ips(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")
     ip = '192.168.123.123'
     if _utils.is_reachable(svc.config):
         svc.create()
         svc.external_ips = [ip]
         svc.update()
         self.assertIn(ip, svc.external_ips)
开发者ID:froch,项目名称:kubernetes-py,代码行数:10,代码来源:test_k8s_service.py


示例17: test_init_with_name_and_config

 def test_init_with_name_and_config(self):
     nspace = "yonamespace"
     config = K8sConfig(kubeconfig=_utils.kubeconfig_fallback, namespace=nspace)
     name = "yoname"
     svc = _utils.create_service(config=config, name=name)
     self.assertIsNotNone(svc)
     self.assertIsInstance(svc, K8sService)
     self.assertEqual(svc.name, name)
     self.assertEqual('Service', svc.obj_type)
     self.assertIsInstance(svc.config, K8sConfig)
     self.assertEqual(nspace, svc.config.namespace)
开发者ID:froch,项目名称:kubernetes-py,代码行数:11,代码来源:test_k8s_service.py


示例18: test_delete

 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)
开发者ID:froch,项目名称:kubernetes-py,代码行数:12,代码来源:test_k8s_service.py


示例19: test_list

 def test_list(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 = svc.list()
         for x in _list:
             self.assertIsInstance(x, K8sService)
         self.assertIsInstance(_list, list)
         self.assertEqual(2, len(_list))  # api server exists already
         from_query = _list[1]
         self.assertEqual(name, from_query.name)
开发者ID:froch,项目名称:kubernetes-py,代码行数:13,代码来源:test_k8s_service.py


示例20: test_get_annotations

 def test_get_annotations(self):
     name = "yoservice"
     svc = _utils.create_service(name=name)
     count = 4
     for i in range(0, count):
         k = "yokey_{0}".format(i)
         v = "yovalue_{0}".format(i)
         svc.add_annotation(k, v)
     self.assertEqual(count, len(svc.annotations))
     for i in range(0, count):
         k = "yokey_{0}".format(i)
         v = "yovalue_{0}".format(i)
         self.assertIn(k, svc.annotations)
         self.assertEqual(v, svc.annotations[k])
开发者ID:froch,项目名称:kubernetes-py,代码行数:14,代码来源:test_k8s_service.py



注:本文中的tests._utils.create_service函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python _utils.is_reachable函数代码示例发布时间:2022-05-27
下一篇:
Python _utils.create_pod函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap