本文整理汇总了Python中tests.utils.create_pod函数的典型用法代码示例。如果您正苦于以下问题:Python create_pod函数的具体用法?Python create_pod怎么用?Python create_pod使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_pod函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_pod_set_termination_grace_period
def test_pod_set_termination_grace_period(self):
name = "yoname"
obj = utils.create_pod(name=name)
secs_in = 1234
obj.set_termination_grace_period(secs_in)
secs_out = obj.get_termination_grace_period()
self.assertEqual(secs_in, secs_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_podbasedobject.py
示例2: test_add_annotation_none_args
def test_add_annotation_none_args(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
try:
pod.add_annotation()
except Exception as err:
self.assertIsInstance(err, SyntaxError)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例3: test_set_annotations
def test_set_annotations(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
anns_in = {'key': 'value'}
pod.set_annotations(anns_in)
anns_out = pod.get_annotations()
self.assertEqual(anns_in, anns_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例4: test_get_label_doesnt_exist
def test_get_label_doesnt_exist(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
k = "yonotexists"
l = pod.get_label(k)
self.assertIsNone(l)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例5: test_set_labels
def test_set_labels(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
labels_in = {'key': 'value'}
pod.set_labels(labels_in)
labels_out = pod.get_labels()
self.assertEqual(labels_in, labels_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例6: test_get_annotation_doesnt_exist
def test_get_annotation_doesnt_exist(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
k = "yonotexists"
ann = pod.get_annotation(k)
self.assertIsNone(ann)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例7: test_struct_pod_model
def test_struct_pod_model(self):
name = "yomama"
pod = utils.create_pod(name=name)
model = pod.model.model
self.assertIsNotNone(model)
self.assertIsInstance(model, dict)
self.assertIn('apiVersion', model)
self.assertIsInstance(model['apiVersion'], str)
self.assertIn('kind', model)
self.assertIsInstance(model['kind'], str)
self.assertIn('metadata', model)
self.assertIsInstance(model['metadata'], dict)
self.assertIn('labels', model['metadata'])
self.assertIsInstance(model['metadata']['labels'], dict)
self.assertIn('name', model['metadata']['labels'])
self.assertEqual(model['metadata']['labels']['name'], name)
self.assertIn('name', model['metadata'])
self.assertIsInstance(model['metadata']['name'], str)
self.assertEqual(model['metadata']['name'], name)
self.assertIn('namespace', model['metadata'])
self.assertIsInstance(model['metadata']['namespace'], str)
self.assertIn('spec', model)
self.assertIsInstance(model['spec'], dict)
self.assertIn('containers', model['spec'])
self.assertIsInstance(model['spec']['containers'], list)
self.assertIn('dnsPolicy', model['spec'])
self.assertIsInstance(model['spec']['dnsPolicy'], str)
self.assertIn('restartPolicy', model['spec'])
self.assertIsInstance(model['spec']['restartPolicy'], str)
self.assertIn('volumes', model['spec'])
self.assertIsInstance(model['spec']['volumes'], list)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:31,代码来源:test_k8s_pod.py
示例8: test_pod_set_pod_restart_policy
def test_pod_set_pod_restart_policy(self):
name = "yoname"
obj = utils.create_pod(name=name)
policy = "Always"
obj.set_pod_restart_policy(policy=policy)
p = obj.get_pod_restart_policy()
self.assertEqual(policy, p)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_podbasedobject.py
示例9: test_list_nonexistent
def test_list_nonexistent(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
if utils.is_reachable(pod.config.api_host):
p = pod.list()
self.assertIsInstance(p, list)
self.assertEqual(0, len(p))
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例10: test_struct_k8spod
def test_struct_k8spod(self):
name = "yomama"
pod = utils.create_pod(name=name)
self.assertIsNotNone(pod)
self.assertIsInstance(pod, K8sPod)
self.assertIsNotNone(pod.model)
self.assertIsInstance(pod.model, Pod)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例11: test_init_with_config_and_pull_secrets
def test_init_with_config_and_pull_secrets(self):
ps = "yomama"
name = "sofat"
cfg = K8sConfig(kubeconfig=utils.kubeconfig_fallback, pull_secret=ps)
pod = utils.create_pod(config=cfg, name=name)
self.assertIsNotNone(pod.config)
self.assertEqual(ps, pod.config.pull_secret)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例12: test_pod_get_pod_node_selector
def test_pod_get_pod_node_selector(self):
name = "yoname"
obj = utils.create_pod(name=name)
s_in = {"disktype": "ssd"}
obj.set_pod_node_selector(selector=s_in)
s_out = obj.get_pod_node_selector()
self.assertEqual(s_in, s_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_podbasedobject.py
示例13: test_pod_get_pod_node_name
def test_pod_get_pod_node_name(self):
name = "yoname"
obj = utils.create_pod(name=name)
nodename = "yonodename"
obj.set_pod_node_name(name=nodename)
name = obj.get_pod_node_name()
self.assertEqual(name, nodename)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_podbasedobject.py
示例14: test_pod_set_service_account
def test_pod_set_service_account(self):
name = "yoname"
obj = utils.create_pod(name=name)
name_in = "yoservice"
obj.set_service_account(name_in)
name_out = obj.get_service_account()
self.assertEqual(name_in, name_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_podbasedobject.py
示例15: test_pod_get_pod_restart_policy
def test_pod_get_pod_restart_policy(self):
name = "yoname"
obj = utils.create_pod(name=name)
p_in = "OnFailure"
obj.set_pod_restart_policy(p_in)
p_out = obj.get_pod_restart_policy()
self.assertEqual(p_in, p_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_podbasedobject.py
示例16: test_set_namespace
def test_set_namespace(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
nspace_in = "yonamespace"
pod.set_namespace(nspace_in)
nspace_out = pod.get_namespace()
self.assertEqual(nspace_in, nspace_out)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例17: test_del_label_none_arg
def test_del_label_none_arg(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
try:
pod.del_label()
except Exception as err:
self.assertIsInstance(err, SyntaxError)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例18: test_set_namespace_none_args
def test_set_namespace_none_args(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
try:
pod.set_namespace()
self.fail("Should not fail.")
except Exception as err:
self.assertIsInstance(err, SyntaxError)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_pod.py
示例19: test_init_with_model_pod
def test_init_with_model_pod(self):
name = "yoname"
obj = utils.create_pod(name=name)
self.assertIsInstance(obj.model, Pod)
self.assertIsInstance(obj.model.model, dict)
self.assertIsInstance(obj.model.pod_metadata, ObjectMeta)
self.assertIsInstance(obj.model.pod_spec, PodSpec)
self.assertIsNone(obj.model.pod_status)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_podbasedobject.py
示例20: test_pod_set_pod_node_selector_invalid_arg
def test_pod_set_pod_node_selector_invalid_arg(self):
name = "yoname"
obj = utils.create_pod(name=name)
s_in = "yoselector"
try:
obj.set_pod_node_selector(selector=s_in)
except Exception as err:
self.assertIsInstance(err, SyntaxError)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_podbasedobject.py
注:本文中的tests.utils.create_pod函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论