本文整理汇总了Python中tests.utils.create_pod函数的典型用法代码示例。如果您正苦于以下问题:Python create_pod函数的具体用法?Python create_pod怎么用?Python create_pod使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_pod函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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))
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)