示例#1
0
 def test_delete_host_from_cluster(self, cluster: Cluster, provider: Provider):
     """Test delete host from cluster"""
     host = provider.host_create(utils.random_string())
     expected = cluster.host_list()
     with allure.step("Create mapping between cluster and host"):
         cluster.host_add(host)
     with allure.step("Deleting host from cluster"):
         cluster.host_delete(host)
     actual = cluster.host_list()
     with allure.step("Check host removed from cluster"):
         assert actual == expected
示例#2
0
 def test_adding_host_to_cluster(self, cluster: Cluster, provider: Provider):
     """Test add host to cluster"""
     host = provider.host_create(utils.random_string())
     expected = cluster.host_add(host)
     with allure.step("Get cluster host info"):
         host_list = cluster.host_list()
         assert len(host_list) == 1
         actual = host_list[0]
     with allure.step("Check mapping"):
         _check_hosts(actual, expected)
示例#3
0
 def test_get_cluster_hosts_list(self, cluster: Cluster, provider: Provider):
     """Test get cluster hosts list"""
     actual, expected = [], []
     with allure.step("Create host list in cluster"):
         for fqdn in utils.random_string_list():
             host = provider.host_create(fqdn)
             cluster.host_add(host)
             expected.append(host.id)
     for host in cluster.host_list():
         actual.append(host.id)
     with allure.step("Check test data"):
         assert actual == expected
示例#4
0
def _check_that_host_exists(cluster: Cluster, host: Host) -> None:
    assert len(cluster.host_list()) == 1, "Only one host expected to be"
    with catch_failed(ObjectNotFound, "Previously created host not found"):
        cluster.host(fqdn=host.fqdn)