Merge "Do not create server in test_list_servers_filter_by_exist_host"
This commit is contained in:
commit
8d437c776b
@ -13,9 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from tempest.api.compute import base
|
from tempest.api.compute import base
|
||||||
from tempest.common import compute
|
|
||||||
from tempest.common import waiters
|
from tempest.common import waiters
|
||||||
from tempest.lib.common import fixed_network
|
|
||||||
from tempest.lib.common.utils import data_utils
|
from tempest.lib.common.utils import data_utils
|
||||||
from tempest.lib import decorators
|
from tempest.lib import decorators
|
||||||
|
|
||||||
@ -126,26 +124,17 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
|
|||||||
@decorators.idempotent_id('86c7a8f7-50cf-43a9-9bac-5b985317134f')
|
@decorators.idempotent_id('86c7a8f7-50cf-43a9-9bac-5b985317134f')
|
||||||
def test_list_servers_filter_by_exist_host(self):
|
def test_list_servers_filter_by_exist_host(self):
|
||||||
# Filter the list of servers by existent host
|
# Filter the list of servers by existent host
|
||||||
name = data_utils.rand_name(self.__class__.__name__ + '-server')
|
server = self.client.show_server(self.s1_id)['server']
|
||||||
network = self.get_tenant_network()
|
|
||||||
network_kwargs = fixed_network.set_networks_kwarg(network)
|
|
||||||
# We need to create the server as an admin, so we can't use
|
|
||||||
# self.create_test_server() here as this method creates the server
|
|
||||||
# in the "primary" (i.e non-admin) tenant.
|
|
||||||
test_server, _ = compute.create_test_server(
|
|
||||||
self.os_admin, wait_until="ACTIVE", name=name, **network_kwargs)
|
|
||||||
self.addCleanup(self.client.delete_server, test_server['id'])
|
|
||||||
server = self.client.show_server(test_server['id'])['server']
|
|
||||||
self.assertEqual(server['status'], 'ACTIVE')
|
|
||||||
hostname = server['OS-EXT-SRV-ATTR:host']
|
hostname = server['OS-EXT-SRV-ATTR:host']
|
||||||
params = {'host': hostname}
|
params = {'host': hostname, 'all_tenants': '1'}
|
||||||
body = self.client.list_servers(**params)
|
servers = self.client.list_servers(**params)['servers']
|
||||||
servers = body['servers']
|
self.assertIn(server['id'], map(lambda x: x['id'], servers))
|
||||||
nonexistent_params = {'host': 'nonexistent_host'}
|
|
||||||
|
nonexistent_params = {'host': 'nonexistent_host',
|
||||||
|
'all_tenants': '1'}
|
||||||
nonexistent_body = self.client.list_servers(**nonexistent_params)
|
nonexistent_body = self.client.list_servers(**nonexistent_params)
|
||||||
nonexistent_servers = nonexistent_body['servers']
|
nonexistent_servers = nonexistent_body['servers']
|
||||||
self.assertIn(test_server['id'], map(lambda x: x['id'], servers))
|
self.assertNotIn(server['id'],
|
||||||
self.assertNotIn(test_server['id'],
|
|
||||||
map(lambda x: x['id'], nonexistent_servers))
|
map(lambda x: x['id'], nonexistent_servers))
|
||||||
|
|
||||||
@decorators.idempotent_id('ee8ae470-db70-474d-b752-690b7892cab1')
|
@decorators.idempotent_id('ee8ae470-db70-474d-b752-690b7892cab1')
|
||||||
|
Loading…
Reference in New Issue
Block a user