本文整理汇总了Python中tests.utils.is_reachable函数的典型用法代码示例。如果您正苦于以下问题:Python is_reachable函数的具体用法?Python is_reachable怎么用?Python is_reachable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_reachable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_get_by_labels_nonexistent
def test_get_by_labels_nonexistent(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
config = K8sConfig(kubeconfig=utils.kubeconfig_fallback)
if utils.is_reachable(config.api_host):
pods = K8sPod.get_by_labels(config=config, labels={'name': name})
self.assertIsInstance(pods, list)
self.assertEqual(0, len(pods))
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_pod.py
示例2: 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
示例3: test_create
def test_create(self):
name = "yosecret-{0}".format(str(uuid.uuid4()))
secret = utils.create_secret(name=name)
if utils.is_reachable(secret.config.api_host):
secret.create()
_list = secret.list()
self.assertEqual(2, len(_list)) # service-account-token + 1
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:7,代码来源:test_k8s_secret.py
示例4: test_get_nonexistent
def test_get_nonexistent(self):
name = "yoservice"
svc = utils.create_service(name=name)
if utils.is_reachable(svc.config.api_host):
try:
svc.get()
except Exception as err:
self.assertIsInstance(err, NotFoundException)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py
示例5: test_update_nothing_changed
def test_update_nothing_changed(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):
from_create = svc.create()
from_update = svc.update()
self.assertEqual(from_create, from_update)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py
示例6: test_get_by_name_nonexistent
def test_get_by_name_nonexistent(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):
_list = K8sService.get_by_name(config=svc.config, name=name)
self.assertIsInstance(_list, list)
self.assertEqual(0, len(_list))
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:8,代码来源:test_k8s_service.py
示例7: test_get_pod_status_nonexistent
def test_get_pod_status_nonexistent(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
config = K8sConfig(kubeconfig=utils.kubeconfig_fallback)
pod = utils.create_pod(name=name)
if utils.is_reachable(pod.config.api_host):
try:
pod.get_status()
except Exception as err:
self.assertIsInstance(err, NotFoundException)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_pod.py
示例8: test_get
def test_get(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()
from_get = svc.get()
self.assertIsInstance(from_get, K8sService)
self.assertEqual(svc, from_get)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_service.py
示例9: test_delete_nonexistent
def test_delete_nonexistent(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):
try:
svc.delete()
except Exception as err:
self.assertIsInstance(err, NotFoundException)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_service.py
示例10: test_is_ready
def test_is_ready(self):
name = "yocontainer"
container = utils.create_container(name=name)
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
pod.add_container(container)
if utils.is_reachable(pod.config.api_host):
p = pod.create()
self.assertTrue(p.is_ready())
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_pod.py
示例11: test_pod_add_volume_hostpath_no_path_specified
def test_pod_add_volume_hostpath_no_path_specified(self):
name = "yoname"
obj = utils.create_pod(name=name)
config = utils.create_config()
vol = K8sVolume(config=config, name=name, mount_path="/var/test", type="hostPath")
if utils.is_reachable(config.api_host):
with self.assertRaises(UnprocessableEntityException):
obj.add_volume(vol)
obj.create()
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_podbasedobject.py
示例12: test_get_doesnt_exist
def test_get_doesnt_exist(self):
name = "yosecret"
secret = utils.create_secret(name=name)
if utils.is_reachable(secret.config.api_host):
try:
secret.get()
self.fail("Should not fail.")
except Exception as err:
self.assertIsInstance(err, NotFoundException)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_secret.py
示例13: test_delete_nonexistent
def test_delete_nonexistent(self):
name = "yosecret-{0}".format(str(uuid.uuid4()))
secret = utils.create_secret(name=name)
if utils.is_reachable(secret.config.api_host):
try:
secret.delete()
self.fail("Should not fail.")
except Exception as err:
self.assertIsInstance(err, NotFoundException)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_secret.py
示例14: test_list_without_create
def test_list_without_create(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):
_list = svc.list()
self.assertIsInstance(_list, list)
self.assertEqual(1, len(_list)) # api server exists already
self.assertIsInstance(_list[0], dict)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_service.py
示例15: test_object_rc_list_from_scratch
def test_object_rc_list_from_scratch(self):
config = K8sConfig(kubeconfig=utils.kubeconfig_fallback)
if config.api_host is not None and utils.is_reachable(config.api_host):
ot = "ReplicationController"
name = "yomama"
obj = utils.create_object(config=config, name=name, obj_type=ot)
r = obj.list()
self.assertIsNotNone(r)
self.assertEqual(0, len(r))
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_object.py
示例16: test_create_without_containers
def test_create_without_containers(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
if utils.is_reachable(pod.config.api_host):
try:
pod.create()
self.fail("Should not fail.")
except Exception as err:
self.assertIsInstance(err, UnprocessableEntityException)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_pod.py
示例17: test_update_nonexistent
def test_update_nonexistent(self):
name = "yopod-{0}".format(str(uuid.uuid4()))
pod = utils.create_pod(name=name)
if utils.is_reachable(pod.config.api_host):
try:
pod.update()
self.fail("Should not fail.")
except Exception as err:
self.assertIsInstance(err, NotFoundException)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:9,代码来源:test_k8s_pod.py
示例18: test_create_name_too_long
def test_create_name_too_long(self):
name = "yo-{0}".format(str(uuid.uuid4()))
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):
try:
svc.create()
self.fail("Should not fail.")
except Exception as err:
self.assertIsInstance(err, UnprocessableEntityException)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:10,代码来源:test_k8s_service.py
示例19: test_create_already_exists
def test_create_already_exists(self):
name = "yosecret-{0}".format(str(uuid.uuid4()))
secret = utils.create_secret(name=name)
if utils.is_reachable(secret.config.api_host):
secret.create()
try:
secret.create()
self.fail("Should not fail.")
except Exception as err:
self.assertIsInstance(err, AlreadyExistsException)
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:10,代码来源:test_k8s_secret.py
示例20: test_update_set_external_ips
def test_update_set_external_ips(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")
ip = '192.168.123.123'
if utils.is_reachable(svc.config.api_host):
svc.create()
svc.set_external_ips([ip])
svc.update()
self.assertIn(ip, svc.model.model['spec']['externalIPs'])
开发者ID:mnubo,项目名称:kubernetes-py,代码行数:10,代码来源:test_k8s_service.py
注:本文中的tests.utils.is_reachable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论