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

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_init_with_invalid_name

 def test_init_with_invalid_name(self):
     name = object()
     try:
         utils.create_service(name=name)
         self.fail("Should not fail.")
     except Exception as err:
         self.assertIsInstance(err, SyntaxError)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例2: test_set_service_type

 def test_set_service_type(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     for i in ['ClusterIP', 'NodePort', 'LoadBalancer']:
         svc.set_service_type(i)
         self.assertIn('type', svc.model.model['spec'])
         self.assertEqual(i, svc.model.model['spec']['type'])
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例3: test_get_labels

 def test_get_labels(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     labels_in = {'yokey': 'yovalue'}
     svc.set_labels(labels_in)
     labels_out = svc.get_labels()
     self.assertEqual(labels_in, labels_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例4: test_set_load_balancer_ip

 def test_set_load_balancer_ip(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     lbip = "192.168.99.100"
     svc.set_load_balancer_ip(lbip)
     self.assertIn('loadBalancerIP', svc.model.model['spec'])
     self.assertEqual(lbip, svc.model.model['spec']['loadBalancerIP'])
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例5: test_add_selector

 def test_add_selector(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     sel = {'abc': 'def'}
     svc.add_selector(selector=sel)
     self.assertIn('selector', svc.model.model['spec'])
     self.assertEqual(sel, svc.model.model['spec']['selector'])
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例6: test_get_meta_generation

 def test_get_meta_generation(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     gen_in = 2
     svc.set_meta_generation(gen_in)
     gen_out = svc.get_meta_generation()
     self.assertEqual(gen_in, gen_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例7: test_get_meta_creation_timestamp

 def test_get_meta_creation_timestamp(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     tstamp_in = "yotimestamp"
     svc.set_meta_creation_timestamp(tstamp_in)
     tstamp_out = svc.get_meta_creation_timestamp()
     self.assertEqual(tstamp_in, tstamp_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例8: test_set_session_affinity

 def test_set_session_affinity(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     for i in ['None', 'ClientIP']:
         svc.set_session_affinity(i)
         self.assertIn('sessionAffinity', svc.model.model['spec'])
         self.assertEqual(i, svc.model.model['spec']['sessionAffinity'])
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例9: test_get_meta_resource_version

 def test_get_meta_resource_version(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     ver_in = "yoversion"
     svc.set_meta_resource_version(ver_in)
     ver_out = svc.get_meta_resource_version()
     self.assertEqual(ver_in, ver_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例10: test_set_external_ip

 def test_set_external_ip(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     eips = ["192.168.99.100"]
     svc.set_external_ips(eips)
     self.assertIn('externalIPs', svc.model.model['spec'])
     self.assertEqual(eips, svc.model.model['spec']['externalIPs'])
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例11: test_set_annotations

 def test_set_annotations(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     anns = {'yokey': 'yovalue'}
     svc.set_annotations(anns)
     self.assertIn('annotations', svc.model.model['metadata'])
     self.assertEqual(anns, svc.model.model['metadata']['annotations'])
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例12: test_set_cluster_ip

 def test_set_cluster_ip(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     cip = "192.168.99.100"
     svc.set_cluster_ip(cip)
     self.assertIn('clusterIP', svc.model.model['spec'])
     self.assertEqual(cip, svc.model.model['spec']['clusterIP'])
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例13: test_get_meta_self_link

 def test_get_meta_self_link(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     slink_in = "yoselflink"
     svc.set_meta_self_link(slink_in)
     slink_out = svc.get_meta_self_link()
     self.assertEqual(slink_in, slink_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例14: test_get_meta_uid

 def test_get_meta_uid(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     uid_in = "yoselflink"
     svc.set_meta_uid(uid_in)
     uid_out = svc.get_meta_uid()
     self.assertEqual(uid_in, uid_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例15: 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.model, dict)
     self.assertIsInstance(svc.model.svc_metadata, ObjectMeta)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例16: test_struct_service_model

 def test_struct_service_model(self):
     name = "yoname"
     svc = utils.create_service(name=name)
     model = svc.model.model
     self.assertIsInstance(model, dict)
     self.assertEqual(4, len(model))
     for i in ['apiVersion', 'kind', 'metadata', 'spec']:
         self.assertIn(i, model)
     for i in ['apiVersion', 'kind']:
         self.assertIsInstance(model[i], str)
     for i in ['metadata', 'spec']:
         self.assertIsInstance(model[i], dict)
     self.assertEqual(3, len(model['metadata']))
     for i in ['labels', 'name', 'namespace']:
         self.assertIn(i, model['metadata'])
     self.assertIsInstance(model['metadata']['labels'], dict)
     for i in ['name', 'namespace']:
         self.assertIsInstance(model['metadata'][i], str)
     self.assertEqual(4, len(model['spec']))
     for i in ['ports', 'selector', 'sessionAffinity', 'type']:
         self.assertIn(i, model['spec'])
     self.assertIsInstance(model['spec']['ports'], list)
     self.assertIsInstance(model['spec']['selector'], dict)
     for i in ['sessionAffinity', 'type']:
         self.assertIsInstance(model['spec'][i], str)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:25,代码来源:test_k8s_service.py


示例17: test_set_labels

 def test_set_labels(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     labels = {'yokey': 'yovalue'}
     svc.set_labels(labels)
     self.assertIn('labels', svc.model.model['metadata'])
     self.assertEqual(labels, svc.model.model['metadata']['labels'])
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例18: test_get_external_ips

 def test_get_external_ips(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     eips_in = ["192.168.99.100"]
     svc.set_external_ips(eips_in)
     eips_out = svc.get_external_ips()
     self.assertEqual(eips_in, eips_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例19: test_get_cluster_ip

 def test_get_cluster_ip(self):
     name = "yoservice"
     svc = utils.create_service(name=name)
     cip_in = "192.168.99.100"
     svc.set_cluster_ip(cip_in)
     cip_out = svc.get_cluster_ip()
     self.assertEqual(cip_in, cip_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_service.py


示例20: test_set_labels_none_arg

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utils.diff_compare函数代码示例发布时间: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