Merge "Remove redundant attach/detach volume methods from test_minimum_basic"
diff --git a/requirements.txt b/requirements.txt
index 66e5b16..d0419f7 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-pbr<2.0,>=0.11
+pbr<2.0,>=1.3
cliff>=1.13.0 # Apache-2.0
anyjson>=0.3.3
httplib2>=0.7.5
@@ -11,13 +11,13 @@
paramiko>=1.13.0
netaddr>=0.7.12
testrepository>=0.0.18
-pyOpenSSL>=0.11
+pyOpenSSL>=0.14
oslo.concurrency>=2.1.0 # Apache-2.0
oslo.config>=1.11.0 # Apache-2.0
oslo.i18n>=1.5.0 # Apache-2.0
-oslo.log>=1.2.0 # Apache-2.0
+oslo.log>=1.6.0 # Apache-2.0
oslo.serialization>=1.4.0 # Apache-2.0
-oslo.utils>=1.6.0 # Apache-2.0
+oslo.utils>=1.9.0 # Apache-2.0
six>=1.9.0
iso8601>=0.1.9
fixtures>=1.3.1
diff --git a/setup.py b/setup.py
index 056c16c..d8080d0 100644
--- a/setup.py
+++ b/setup.py
@@ -25,5 +25,5 @@
pass
setuptools.setup(
- setup_requires=['pbr'],
+ setup_requires=['pbr>=1.3'],
pbr=True)
diff --git a/tempest/api/compute/admin/test_agents.py b/tempest/api/compute/admin/test_agents.py
index 1aa1615..d9a1ee5 100644
--- a/tempest/api/compute/admin/test_agents.py
+++ b/tempest/api/compute/admin/test_agents.py
@@ -109,8 +109,7 @@
self.addCleanup(self.client.delete_agent, agent_xen['agent_id'])
agent_id_xen = agent_xen['agent_id']
- params_filter = {'hypervisor': agent_xen['hypervisor']}
- agents = self.client.list_agents(params_filter)
+ agents = self.client.list_agents(hypervisor=agent_xen['hypervisor'])
self.assertTrue(len(agents) > 0, 'Cannot get any agents.(%s)' % agents)
self.assertIn(agent_id_xen, map(lambda x: x['agent_id'], agents))
self.assertNotIn(self.agent_id, map(lambda x: x['agent_id'], agents))
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index 9fee2a1..0dadea5 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -38,9 +38,7 @@
self.useFixture(fixtures.LockFixture('availability_zone'))
hosts = self.client.list_hosts()
host = hosts[0]
- zone_name = host['zone']
- params = {'zone': zone_name}
- hosts = self.client.list_hosts(params)
+ hosts = self.client.list_hosts(zone=host['zone'])
self.assertTrue(len(hosts) >= 1)
self.assertIn(host, hosts)
@@ -48,16 +46,14 @@
def test_list_hosts_with_a_blank_zone(self):
# If send the request with a blank zone, the request will be successful
# and it will return all the hosts list
- params = {'zone': ''}
- hosts = self.client.list_hosts(params)
+ hosts = self.client.list_hosts(zone='')
self.assertNotEqual(0, len(hosts))
@test.idempotent_id('c6ddbadb-c94e-4500-b12f-8ffc43843ff8')
def test_list_hosts_with_nonexistent_zone(self):
# If send the request with a nonexistent zone, the request will be
# successful and no hosts will be retured
- params = {'zone': 'xxx'}
- hosts = self.client.list_hosts(params)
+ hosts = self.client.list_hosts(zone='xxx')
self.assertEqual(0, len(hosts))
@test.idempotent_id('38adbb12-aee2-4498-8aec-329c72423aa4')
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index 548cd4f..6ffa4e9 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -17,6 +17,7 @@
import testtools
from tempest.api.compute import base
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -103,10 +104,11 @@
if state == 'PAUSED':
self.admin_servers_client.pause_server(server_id)
- self.admin_servers_client.wait_for_server_status(server_id, state)
+ waiters.wait_for_server_status(self.admin_servers_client,
+ server_id, state)
self._migrate_server_to(server_id, target_host)
- self.servers_client.wait_for_server_status(server_id, state)
+ waiters.wait_for_server_status(self.servers_client, server_id, state)
self.assertEqual(target_host, self._get_host_for_server(server_id))
@test.idempotent_id('1dce86b8-eb04-4c03-a9d8-9c1dc3ee0c7b')
@@ -156,5 +158,6 @@
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
self._migrate_server_to(server_id, target_host)
- self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client,
+ server_id, 'ACTIVE')
self.assertEqual(target_host, self._get_host_for_server(server_id))
diff --git a/tempest/api/compute/admin/test_migrations.py b/tempest/api/compute/admin/test_migrations.py
index 5434d93..5af7406 100644
--- a/tempest/api/compute/admin/test_migrations.py
+++ b/tempest/api/compute/admin/test_migrations.py
@@ -15,6 +15,7 @@
import testtools
from tempest.api.compute import base
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -42,9 +43,11 @@
server_id = server['id']
self.servers_client.resize(server_id, self.flavor_ref_alt)
- self.servers_client.wait_for_server_status(server_id, 'VERIFY_RESIZE')
+ waiters.wait_for_server_status(self.servers_client,
+ server_id, 'VERIFY_RESIZE')
self.servers_client.confirm_resize(server_id)
- self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client,
+ server_id, 'ACTIVE')
body = self.client.list_migrations()
diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py
index 2c3c629..ff87a4f 100644
--- a/tempest/api/compute/admin/test_security_groups.py
+++ b/tempest/api/compute/admin/test_security_groups.py
@@ -69,8 +69,7 @@
security_group_list.append(adm_securitygroup)
# Fetch all security groups based on 'all_tenants' search filter
- param = {'all_tenants': 'true'}
- fetched_list = self.adm_client.list_security_groups(params=param)
+ fetched_list = self.adm_client.list_security_groups(all_tenants='true')
sec_group_id_list = map(lambda sg: sg['id'], fetched_list)
# Now check if all created Security Groups are present in fetched list
for sec_group in security_group_list:
@@ -78,7 +77,7 @@
# Fetch all security groups for non-admin user with 'all_tenants'
# search filter
- fetched_list = self.client.list_security_groups(params=param)
+ fetched_list = self.client.list_security_groups(all_tenants='true')
# Now check if all created Security Groups are present in fetched list
for sec_group in fetched_list:
self.assertEqual(sec_group['tenant_id'], client_tenant_id,
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index 51a03f5..1982eda 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -17,6 +17,7 @@
from tempest.api.compute import base
from tempest.common import fixed_network
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import test
@@ -113,7 +114,8 @@
test_server = self.client.create_server(name, image_id, flavor,
**network_kwargs)
self.addCleanup(self.client.delete_server, test_server['id'])
- self.client.wait_for_server_status(test_server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.client,
+ test_server['id'], 'ACTIVE')
server = self.client.show_server(test_server['id'])
self.assertEqual(server['status'], 'ACTIVE')
hostname = server[self._host_key]
@@ -163,7 +165,7 @@
self.client.reset_state(self.s1_id, state='error')
rebuilt_server = self.non_admin_client.rebuild(
self.s1_id, self.image_ref_alt)
- self.addCleanup(self.non_admin_client.wait_for_server_status,
+ self.addCleanup(waiters.wait_for_server_status, self.non_admin_client,
self.s1_id, 'ACTIVE')
self.addCleanup(self.non_admin_client.rebuild, self.s1_id,
self.image_ref)
@@ -173,9 +175,9 @@
rebuilt_image_id = rebuilt_server['image']['id']
self.assertEqual(self.image_ref_alt, rebuilt_image_id)
self.assertEqual(self.flavor_ref, rebuilt_server['flavor']['id'])
- self.non_admin_client.wait_for_server_status(rebuilt_server['id'],
- 'ACTIVE',
- raise_on_error=False)
+ waiters.wait_for_server_status(self.non_admin_client,
+ rebuilt_server['id'], 'ACTIVE',
+ raise_on_error=False)
# Verify the server properties after rebuilding
server = self.non_admin_client.show_server(rebuilt_server['id'])
rebuilt_image_id = server['image']['id']
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index 6d3c4a3..b93aaca 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -20,6 +20,7 @@
from tempest.api.compute import base
from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -151,7 +152,8 @@
server_id = server['id']
# suspend the server.
self.client.suspend_server(server_id)
- self.client.wait_for_server_status(server_id, 'SUSPENDED')
+ waiters.wait_for_server_status(self.client,
+ server_id, 'SUSPENDED')
# migrate an suspended server should fail
self.assertRaises(lib_exc.Conflict,
self.client.migrate_server,
diff --git a/tempest/api/compute/admin/test_services.py b/tempest/api/compute/admin/test_services.py
index dd3e78c..db22925 100644
--- a/tempest/api/compute/admin/test_services.py
+++ b/tempest/api/compute/admin/test_services.py
@@ -37,8 +37,7 @@
@test.idempotent_id('f345b1ec-bc6e-4c38-a527-3ca2bc00bef5')
def test_get_service_by_service_binary_name(self):
binary_name = 'nova-compute'
- params = {'binary': binary_name}
- services = self.client.list_services(params)
+ services = self.client.list_services(binary=binary_name)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(binary_name, service['binary'])
@@ -49,9 +48,8 @@
host_name = services[0]['host']
services_on_host = [service for service in services if
service['host'] == host_name]
- params = {'host': host_name}
- services = self.client.list_services(params)
+ services = self.client.list_services(host=host_name)
# we could have a periodic job checkin between the 2 service
# lookups, so only compare binary lists.
@@ -67,9 +65,9 @@
services = self.client.list_services()
host_name = services[0]['host']
binary_name = services[0]['binary']
- params = {'host': host_name, 'binary': binary_name}
- services = self.client.list_services(params)
+ services = self.client.list_services(host=host_name,
+ binary=binary_name)
self.assertEqual(1, len(services))
self.assertEqual(host_name, services[0]['host'])
self.assertEqual(binary_name, services[0]['binary'])
diff --git a/tempest/api/compute/admin/test_services_negative.py b/tempest/api/compute/admin/test_services_negative.py
index 99f31c5..b9335c9 100644
--- a/tempest/api/compute/admin/test_services_negative.py
+++ b/tempest/api/compute/admin/test_services_negative.py
@@ -41,8 +41,7 @@
def test_get_service_by_invalid_params(self):
# return all services if send the request with invalid parameter
services = self.client.list_services()
- params = {'xxx': 'nova-compute'}
- services_xxx = self.client.list_services(params)
+ services_xxx = self.client.list_services(xxx='nova-compute')
self.assertEqual(len(services), len(services_xxx))
@test.attr(type=['negative'])
@@ -50,8 +49,7 @@
def test_get_service_by_invalid_service_and_valid_host(self):
services = self.client.list_services()
host_name = services[0]['host']
- params = {'host': host_name, 'binary': 'xxx'}
- services = self.client.list_services(params)
+ services = self.client.list_services(host=host_name, binary='xxx')
self.assertEqual(0, len(services))
@test.attr(type=['negative'])
@@ -59,6 +57,5 @@
def test_get_service_with_valid_service_and_invalid_host(self):
services = self.client.list_services()
binary_name = services[0]['binary']
- params = {'host': 'xxx', 'binary': binary_name}
- services = self.client.list_services(params)
+ services = self.client.list_services(host='xxx', binary=binary_name)
self.assertEqual(0, len(services))
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage.py b/tempest/api/compute/admin/test_simple_tenant_usage.py
index 02085e8..1c9e5d7 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage.py
@@ -49,28 +49,22 @@
@test.idempotent_id('062c8ae9-9912-4249-8b51-e38d664e926e')
def test_list_usage_all_tenants(self):
# Get usage for all tenants
- params = {'start': self.start,
- 'end': self.end,
- 'detailed': int(bool(True))}
- tenant_usage = self.adm_client.list_tenant_usages(params)
+ tenant_usage = self.adm_client.list_tenant_usages(
+ start=self.start, end=self.end, detailed=int(bool(True)))
self.assertEqual(len(tenant_usage), 8)
@test.idempotent_id('94135049-a4c5-4934-ad39-08fa7da4f22e')
def test_get_usage_tenant(self):
# Get usage for a specific tenant
- params = {'start': self.start,
- 'end': self.end}
tenant_usage = self.adm_client.show_tenant_usage(
- self.tenant_id, params)
+ self.tenant_id, start=self.start, end=self.end)
self.assertEqual(len(tenant_usage), 8)
@test.idempotent_id('9d00a412-b40e-4fd9-8eba-97b496316116')
def test_get_usage_tenant_with_non_admin_user(self):
# Get usage for a specific tenant with non admin user
- params = {'start': self.start,
- 'end': self.end}
tenant_usage = self.client.show_tenant_usage(
- self.tenant_id, params)
+ self.tenant_id, start=self.start, end=self.end)
self.assertEqual(len(tenant_usage), 8)
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
index 3c66859..934fc31 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
@@ -48,7 +48,7 @@
'end': self.end}
self.assertRaises(lib_exc.NotFound,
self.adm_client.show_tenant_usage,
- '', params)
+ '', **params)
@test.attr(type=['negative'])
@test.idempotent_id('4079dd2a-9e8d-479f-869d-6fa985ce45b6')
@@ -58,7 +58,7 @@
'end': self.start}
self.assertRaises(lib_exc.BadRequest,
self.adm_client.show_tenant_usage,
- self.client.tenant_id, params)
+ self.client.tenant_id, **params)
@test.attr(type=['negative'])
@test.idempotent_id('bbe6fe2c-15d8-404c-a0a2-44fad0ad5cc7')
@@ -68,4 +68,4 @@
'end': self.end,
'detailed': int(bool(True))}
self.assertRaises(lib_exc.Forbidden,
- self.client.list_tenant_usages, params)
+ self.client.list_tenant_usages, **params)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index ea8e112..37c1e0a 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -144,8 +144,8 @@
"""
if getattr(cls, 'server_id', None) is not None:
try:
- cls.servers_client.wait_for_server_status(cls.server_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(cls.servers_client,
+ cls.server_id, 'ACTIVE')
except Exception as exc:
LOG.exception(exc)
cls.servers_client.delete_server(cls.server_id)
@@ -289,8 +289,8 @@
if kwargs['wait_until'] == 'ACTIVE':
if kwargs.get('wait_for_server', True):
- cls.servers_client.wait_for_server_status(server_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(cls.servers_client,
+ server_id, 'ACTIVE')
return image
@classmethod
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index 2cc1b59..8bb4fac 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -17,6 +17,7 @@
from tempest.api.compute.floating_ips import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import test
@@ -113,7 +114,8 @@
# Create server so as to use for Multiple association
new_name = data_utils.rand_name('floating_server')
body = self.create_test_server(name=new_name)
- self.servers_client.wait_for_server_status(body['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client,
+ body['id'], 'ACTIVE')
self.new_server_id = body['id']
self.addCleanup(self.servers_client.delete_server, self.new_server_id)
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index 07eca9e..9721fa5 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -16,6 +16,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -74,8 +75,8 @@
def test_create_image_from_stopped_server(self):
server = self.create_test_server(wait_until='ACTIVE')
self.servers_client.stop(server['id'])
- self.servers_client.wait_for_server_status(server['id'],
- 'SHUTOFF')
+ waiters.wait_for_server_status(self.servers_client,
+ server['id'], 'SHUTOFF')
self.addCleanup(self.servers_client.delete_server, server['id'])
snapshot_name = data_utils.rand_name('test-snap')
image = self.create_image_from_server(server['id'],
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 1741e86..40a781c 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -38,8 +38,8 @@
super(ImagesOneServerTestJSON, self).setUp()
# Check if the server is in a clean state after test
try:
- self.servers_client.wait_for_server_status(self.server_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client,
+ self.server_id, 'ACTIVE')
except Exception:
LOG.exception('server %s timed out to become ACTIVE. rebuilding'
% self.server_id)
diff --git a/tempest/api/compute/images/test_images_oneserver_negative.py b/tempest/api/compute/images/test_images_oneserver_negative.py
index 1cd1ab7..2f78e9d 100644
--- a/tempest/api/compute/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/images/test_images_oneserver_negative.py
@@ -19,6 +19,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -43,8 +44,8 @@
super(ImagesOneServerNegativeTestJSON, self).setUp()
# Check if the server is in a clean state after test
try:
- self.servers_client.wait_for_server_status(self.server_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, self.server_id,
+ 'ACTIVE')
except Exception:
LOG.exception('server %s timed out to become ACTIVE. rebuilding'
% self.server_id)
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index b0bbc91..2c0ce59 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -81,8 +81,8 @@
cls.server1 = cls.create_test_server()
cls.server2 = cls.create_test_server(wait_until='ACTIVE')
# NOTE(sdague) this is faster than doing the sync wait_util on both
- cls.servers_client.wait_for_server_status(cls.server1['id'],
- 'ACTIVE')
+ waiters.wait_for_server_status(cls.servers_client,
+ cls.server1['id'], 'ACTIVE')
# Create images to be used in the filter tests
cls.snapshot1 = cls.create_image_from_server(
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 491e52e..bd252b0 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -17,6 +17,7 @@
from tempest.api.compute.security_groups import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import test
@@ -97,7 +98,8 @@
server_name = data_utils.rand_name('server')
server = self.create_test_server(name=server_name)
server_id = server['id']
- self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, server_id,
+ 'ACTIVE')
self.servers_client.add_security_group(server_id, sg['name'])
# Check that we are not able to delete the security
@@ -108,7 +110,8 @@
# Reboot and add the other security group
self.servers_client.reboot(server_id, 'HARD')
- self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, server_id,
+ 'ACTIVE')
self.servers_client.add_security_group(server_id, sg2['name'])
# Check that we are not able to delete the other security
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index 990ad47..b2acd34 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -52,7 +52,7 @@
# Delete a server while it's VM state is Shutoff
server = self.create_test_server(wait_until='ACTIVE')
self.client.stop(server['id'])
- self.client.wait_for_server_status(server['id'], 'SHUTOFF')
+ waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@@ -63,7 +63,7 @@
# Delete a server while it's VM state is Pause
server = self.create_test_server(wait_until='ACTIVE')
self.client.pause_server(server['id'])
- self.client.wait_for_server_status(server['id'], 'PAUSED')
+ waiters.wait_for_server_status(self.client, server['id'], 'PAUSED')
self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@@ -74,7 +74,7 @@
# Delete a server while it's VM state is Suspended
server = self.create_test_server(wait_until='ACTIVE')
self.client.suspend_server(server['id'])
- self.client.wait_for_server_status(server['id'], 'SUSPENDED')
+ waiters.wait_for_server_status(self.client, server['id'], 'SUSPENDED')
self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@@ -88,12 +88,12 @@
offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
- self.client.wait_for_server_status(server['id'],
- 'SHELVED_OFFLOADED',
- extra_timeout=offload_time)
+ waiters.wait_for_server_status(self.client, server['id'],
+ 'SHELVED_OFFLOADED',
+ extra_timeout=offload_time)
else:
- self.client.wait_for_server_status(server['id'],
- 'SHELVED')
+ waiters.wait_for_server_status(self.client, server['id'],
+ 'SHELVED')
self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
@@ -104,7 +104,8 @@
# Delete a server while it's VM state is VERIFY_RESIZE
server = self.create_test_server(wait_until='ACTIVE')
self.client.resize(server['id'], self.flavor_ref_alt)
- self.client.wait_for_server_status(server['id'], 'VERIFY_RESIZE')
+ waiters.wait_for_server_status(self.client, server['id'],
+ 'VERIFY_RESIZE')
self.client.delete_server(server['id'])
self.client.wait_for_server_termination(server['id'])
diff --git a/tempest/api/compute/servers/test_disk_config.py b/tempest/api/compute/servers/test_disk_config.py
index 00aa510..3e8a0d2 100644
--- a/tempest/api/compute/servers/test_disk_config.py
+++ b/tempest/api/compute/servers/test_disk_config.py
@@ -16,6 +16,7 @@
import testtools
from tempest.api.compute import base
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -47,7 +48,7 @@
if disk_config != server['OS-DCF:diskConfig']:
server = self.client.update_server(self.server_id,
disk_config=disk_config)
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
server = self.client.show_server(server['id'])
self.assertEqual(disk_config, server['OS-DCF:diskConfig'])
@@ -61,7 +62,7 @@
disk_config='MANUAL')
# Wait for the server to become active
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
# Verify the specified attributes are set correctly
server = self.client.show_server(server['id'])
@@ -77,7 +78,7 @@
disk_config='AUTO')
# Wait for the server to become active
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
# Verify the specified attributes are set correctly
server = self.client.show_server(server['id'])
@@ -101,9 +102,10 @@
# Resize with auto option
flavor_id = self._get_alternative_flavor()
self.client.resize(self.server_id, flavor_id, disk_config='AUTO')
- self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'VERIFY_RESIZE')
self.client.confirm_resize(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
server = self.client.show_server(self.server_id)
self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
@@ -118,9 +120,10 @@
# Resize with manual option
flavor_id = self._get_alternative_flavor()
self.client.resize(self.server_id, flavor_id, disk_config='MANUAL')
- self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'VERIFY_RESIZE')
self.client.confirm_resize(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
server = self.client.show_server(self.server_id)
self.assertEqual('MANUAL', server['OS-DCF:diskConfig'])
@@ -133,7 +136,7 @@
# Update the disk_config attribute to manual
server = self.client.update_server(self.server_id,
disk_config='MANUAL')
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
# Verify the disk_config attribute is set correctly
server = self.client.show_server(server['id'])
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index 6233c58..dc126a5 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -14,6 +14,7 @@
# under the License.
from tempest.api.compute import base
+from tempest.common import waiters
from tempest import test
@@ -35,7 +36,7 @@
def test_list_instance_actions(self):
# List actions of the provided server
self.client.reboot(self.server_id, 'HARD')
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
body = self.client.list_instance_actions(self.server_id)
self.assertTrue(len(body) == 2, str(body))
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index 6d546d8..a75cb3e 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -19,6 +19,7 @@
from tempest.api import utils
from tempest.common import fixed_network
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -137,12 +138,12 @@
# Filter the list of servers by server shutoff status
params = {'status': 'shutoff'}
self.client.stop(self.s1['id'])
- self.client.wait_for_server_status(self.s1['id'],
- 'SHUTOFF')
+ waiters.wait_for_server_status(self.client, self.s1['id'],
+ 'SHUTOFF')
body = self.client.list_servers(**params)
self.client.start(self.s1['id'])
- self.client.wait_for_server_status(self.s1['id'],
- 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.s1['id'],
+ 'ACTIVE')
servers = body['servers']
self.assertIn(self.s1['id'], map(lambda x: x['id'], servers))
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 3aff595..b95250a 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -24,6 +24,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -41,7 +42,8 @@
super(ServerActionsTestJSON, self).setUp()
# Check if the server is in a clean state after test
try:
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client,
+ self.server_id, 'ACTIVE')
except lib_exc.NotFound:
# The server was deleted by previous test, create a new one
server = self.create_test_server(wait_until='ACTIVE')
@@ -72,7 +74,7 @@
# The server's password should be set to the provided password
new_password = 'Newpass1234'
self.client.change_password(self.server_id, new_password)
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
if self.run_ssh:
# Verify that the user can authenticate with the new password
@@ -90,7 +92,7 @@
boot_time = linux_client.get_boot_time()
self.client.reboot(self.server_id, reboot_type)
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
if self.run_ssh:
# Log in and verify the boot time has changed
@@ -114,7 +116,7 @@
def _rebuild_server_and_check(self, image_ref):
rebuilt_server = self.client.rebuild(self.server_id, image_ref)
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
msg = ('Server was not rebuilt to the original image. '
'The original image: {0}. The current image: {1}'
.format(image_ref, rebuilt_server['image']['id']))
@@ -148,7 +150,8 @@
self.assertEqual(self.flavor_ref, rebuilt_server['flavor']['id'])
# Verify the server properties after the rebuild completes
- self.client.wait_for_server_status(rebuilt_server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.client,
+ rebuilt_server['id'], 'ACTIVE')
server = self.client.show_server(rebuilt_server['id'])
rebuilt_image_id = server['image']['id']
self.assertTrue(self.image_ref_alt.endswith(rebuilt_image_id))
@@ -169,7 +172,7 @@
new_image = (self.image_ref_alt
if old_image == self.image_ref else self.image_ref)
self.client.stop(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'SHUTOFF')
+ waiters.wait_for_server_status(self.client, self.server_id, 'SHUTOFF')
rebuilt_server = self.client.rebuild(self.server_id, new_image)
# If the server was rebuilt on a different image, restore it to the
# original image once the test ends
@@ -183,7 +186,8 @@
self.assertEqual(self.flavor_ref, rebuilt_server['flavor']['id'])
# Verify the server properties after the rebuild completes
- self.client.wait_for_server_status(rebuilt_server['id'], 'SHUTOFF')
+ waiters.wait_for_server_status(self.client,
+ rebuilt_server['id'], 'SHUTOFF')
server = self.client.show_server(rebuilt_server['id'])
rebuilt_image_id = server['image']['id']
self.assertEqual(new_image, rebuilt_image_id)
@@ -195,16 +199,18 @@
# the provided flavor
if stop:
- self.servers_client.stop(self.server_id)
- self.servers_client.wait_for_server_status(self.server_id,
- 'SHUTOFF')
+ self.client.stop(self.server_id)
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'SHUTOFF')
self.client.resize(self.server_id, self.flavor_ref_alt)
- self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'VERIFY_RESIZE')
self.client.confirm_resize(self.server_id)
expected_status = 'SHUTOFF' if stop else 'ACTIVE'
- self.client.wait_for_server_status(self.server_id, expected_status)
+ waiters.wait_for_server_status(self.client, self.server_id,
+ expected_status)
server = self.client.show_server(self.server_id)
self.assertEqual(self.flavor_ref_alt, server['flavor']['id'])
@@ -237,10 +243,11 @@
# values after a resize is reverted
self.client.resize(self.server_id, self.flavor_ref_alt)
- self.client.wait_for_server_status(self.server_id, 'VERIFY_RESIZE')
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'VERIFY_RESIZE')
self.client.revert_resize(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
server = self.client.show_server(self.server_id)
self.assertEqual(self.flavor_ref, server['flavor']['id'])
@@ -253,10 +260,10 @@
# Positive test:create backup successfully and rotate backups correctly
# create the first and the second backup
backup1 = data_utils.rand_name('backup-1')
- resp = self.servers_client.create_backup(self.server_id,
- 'daily',
- 2,
- backup1).response
+ resp = self.client.create_backup(self.server_id,
+ 'daily',
+ 2,
+ backup1).response
oldest_backup_exist = True
# the oldest one should be deleted automatically in this test
@@ -276,11 +283,11 @@
self.os.image_client.wait_for_image_status(image1_id, 'active')
backup2 = data_utils.rand_name('backup-2')
- self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
- resp = self.servers_client.create_backup(self.server_id,
- 'daily',
- 2,
- backup2).response
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ resp = self.client.create_backup(self.server_id,
+ 'daily',
+ 2,
+ backup2).response
image2_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(self.os.image_client.delete_image, image2_id)
self.os.image_client.wait_for_image_status(image2_id, 'active')
@@ -304,15 +311,15 @@
# create the third one, due to the rotation is 2,
# the first one will be deleted
backup3 = data_utils.rand_name('backup-3')
- self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
- resp = self.servers_client.create_backup(self.server_id,
- 'daily',
- 2,
- backup3).response
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ resp = self.client.create_backup(self.server_id,
+ 'daily',
+ 2,
+ backup3).response
image3_id = data_utils.parse_image_id(resp['location'])
self.addCleanup(self.os.image_client.delete_image, image3_id)
# the first back up should be deleted
- self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
self.os.image_client.wait_for_resource_deletion(image1_id)
oldest_backup_exist = False
image_list = self.os.image_client.list_images(
@@ -330,7 +337,7 @@
(image_list[0]['name'], image_list[1]['name']))
def _get_output(self):
- output = self.servers_client.get_console_output(
+ output = self.client.get_console_output(
self.server_id, 10).data
self.assertTrue(output, "Console output was empty.")
lines = len(output.split('\n'))
@@ -348,9 +355,8 @@
# log file is truncated and we cannot get any console log through
# "console-log" API.
# The detail is https://bugs.launchpad.net/nova/+bug/1251920
- self.servers_client.reboot(self.server_id, 'HARD')
- self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
-
+ self.client.reboot(self.server_id, 'HARD')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
self.wait_for(self._get_output)
@test.idempotent_id('89104062-69d8-4b19-a71b-f47b7af093d7')
@@ -360,8 +366,8 @@
server = self.create_test_server(wait_until='ACTIVE')
def _check_full_length_console_log():
- output = self.servers_client.get_console_output(server['id'],
- None).data
+ output = self.client.get_console_output(server['id'],
+ None).data
self.assertTrue(output, "Console output was empty.")
lines = len(output.split('\n'))
@@ -385,9 +391,8 @@
server = self.create_test_server(wait_until='ACTIVE')
temp_server_id = server['id']
- self.servers_client.stop(temp_server_id)
- self.servers_client.wait_for_server_status(temp_server_id, 'SHUTOFF')
-
+ self.client.stop(temp_server_id)
+ waiters.wait_for_server_status(self.client, temp_server_id, 'SHUTOFF')
self.wait_for(self._get_output)
@test.idempotent_id('bd61a9fd-062f-4670-972b-2d6c3e3b9e73')
@@ -395,18 +400,19 @@
'Pause is not available.')
def test_pause_unpause_server(self):
self.client.pause_server(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'PAUSED')
+ waiters.wait_for_server_status(self.client, self.server_id, 'PAUSED')
self.client.unpause_server(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
@test.idempotent_id('0d8ee21e-b749-462d-83da-b85b41c86c7f')
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
'Suspend is not available.')
def test_suspend_resume_server(self):
self.client.suspend_server(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'SUSPENDED')
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'SUSPENDED')
self.client.resume_server(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
@test.idempotent_id('77eba8e0-036e-4635-944b-f7a8f3b78dc9')
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
@@ -416,16 +422,16 @@
offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
- self.client.wait_for_server_status(self.server_id,
- 'SHELVED_OFFLOADED',
- extra_timeout=offload_time)
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'SHELVED_OFFLOADED',
+ extra_timeout=offload_time)
else:
- self.client.wait_for_server_status(self.server_id,
- 'SHELVED')
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'SHELVED')
self.client.shelve_offload_server(self.server_id)
- self.client.wait_for_server_status(self.server_id,
- 'SHELVED_OFFLOADED')
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'SHELVED_OFFLOADED')
server = self.client.show_server(self.server_id)
image_name = server['name'] + '-shelved'
@@ -435,29 +441,29 @@
self.assertEqual(image_name, images[0]['name'])
self.client.unshelve_server(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
@test.idempotent_id('af8eafd4-38a7-4a4b-bdbc-75145a580560')
def test_stop_start_server(self):
- self.servers_client.stop(self.server_id)
- self.servers_client.wait_for_server_status(self.server_id, 'SHUTOFF')
- self.servers_client.start(self.server_id)
- self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
+ self.client.stop(self.server_id)
+ waiters.wait_for_server_status(self.client, self.server_id, 'SHUTOFF')
+ self.client.start(self.server_id)
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
@test.idempotent_id('80a8094c-211e-440a-ab88-9e59d556c7ee')
def test_lock_unlock_server(self):
# Lock the server,try server stop(exceptions throw),unlock it and retry
- self.servers_client.lock_server(self.server_id)
- server = self.servers_client.show_server(self.server_id)
+ self.client.lock_server(self.server_id)
+ server = self.client.show_server(self.server_id)
self.assertEqual(server['status'], 'ACTIVE')
# Locked server is not allowed to be stopped by non-admin user
self.assertRaises(lib_exc.Conflict,
- self.servers_client.stop, self.server_id)
- self.servers_client.unlock_server(self.server_id)
- self.servers_client.stop(self.server_id)
- self.servers_client.wait_for_server_status(self.server_id, 'SHUTOFF')
- self.servers_client.start(self.server_id)
- self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
+ self.client.stop, self.server_id)
+ self.client.unlock_server(self.server_id)
+ self.client.stop(self.server_id)
+ waiters.wait_for_server_status(self.client, self.server_id, 'SHUTOFF')
+ self.client.start(self.server_id)
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
def _validate_url(self, url):
valid_scheme = ['http', 'https']
@@ -473,8 +479,8 @@
# Get the VNC console of type 'novnc' and 'xvpvnc'
console_types = ['novnc', 'xvpvnc']
for console_type in console_types:
- body = self.servers_client.get_vnc_console(self.server_id,
- console_type)
+ body = self.client.get_vnc_console(self.server_id,
+ console_type)
self.assertEqual(console_type, body['type'])
self.assertNotEqual('', body['url'])
self._validate_url(body['url'])
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 20bc77f..98a2f9d 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -15,6 +15,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -56,7 +57,8 @@
server = cls.create_test_server(wait_until='BUILD')
cls.server_id = server['id']
cls.password = server['adminPass']
- cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(cls.servers_client, cls.server_id,
+ 'ACTIVE')
def setUp(self):
super(ServerRescueTestJSON, self).setUp()
@@ -74,22 +76,26 @@
def _unrescue(self, server_id):
self.servers_client.unrescue_server(server_id)
- self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, server_id,
+ 'ACTIVE')
@test.idempotent_id('fd032140-714c-42e4-a8fd-adcd8df06be6')
def test_rescue_unrescue_instance(self):
self.servers_client.rescue_server(
self.server_id, adminPass=self.password)
- self.servers_client.wait_for_server_status(self.server_id, 'RESCUE')
+ waiters.wait_for_server_status(self.servers_client, self.server_id,
+ 'RESCUE')
self.servers_client.unrescue_server(self.server_id)
- self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, self.server_id,
+ 'ACTIVE')
@test.idempotent_id('4842e0cf-e87d-4d9d-b61f-f4791da3cacc')
def test_rescued_vm_associate_dissociate_floating_ip(self):
# Rescue the server
self.servers_client.rescue_server(
self.server_id, adminPass=self.password)
- self.servers_client.wait_for_server_status(self.server_id, 'RESCUE')
+ waiters.wait_for_server_status(self.servers_client, self.server_id,
+ 'RESCUE')
self.addCleanup(self._unrescue, self.server_id)
# Association of floating IP to a rescued vm
@@ -106,7 +112,8 @@
# Rescue the server
self.servers_client.rescue_server(
self.server_id, adminPass=self.password)
- self.servers_client.wait_for_server_status(self.server_id, 'RESCUE')
+ waiters.wait_for_server_status(self.servers_client, self.server_id,
+ 'RESCUE')
self.addCleanup(self._unrescue, self.server_id)
# Add Security group
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index 4300dd4..2fe63ed 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -54,8 +54,10 @@
cls.servers_client.rescue_server(
cls.rescue_id, adminPass=rescue_password)
- cls.servers_client.wait_for_server_status(cls.rescue_id, 'RESCUE')
- cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(cls.servers_client,
+ cls.rescue_id, 'RESCUE')
+ waiters.wait_for_server_status(cls.servers_client,
+ cls.server_id, 'ACTIVE')
def _create_volume(self):
volume = self.volumes_extensions_client.create_volume(
@@ -73,11 +75,13 @@
def _unrescue(self, server_id):
self.servers_client.unrescue_server(server_id)
- self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client,
+ server_id, 'ACTIVE')
def _unpause(self, server_id):
self.servers_client.unpause_server(server_id)
- self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client,
+ server_id, 'ACTIVE')
@test.idempotent_id('cc3a883f-43c0-4fb6-a9bb-5579d64984ed')
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -87,7 +91,8 @@
# Rescue a paused server
self.servers_client.pause_server(self.server_id)
self.addCleanup(self._unpause, self.server_id)
- self.servers_client.wait_for_server_status(self.server_id, 'PAUSED')
+ waiters.wait_for_server_status(self.servers_client,
+ self.server_id, 'PAUSED')
self.assertRaises(lib_exc.Conflict,
self.servers_client.rescue_server,
self.server_id)
@@ -124,7 +129,8 @@
# Rescue the server
self.servers_client.rescue_server(self.server_id,
adminPass=self.password)
- self.servers_client.wait_for_server_status(self.server_id, 'RESCUE')
+ waiters.wait_for_server_status(self.servers_client,
+ self.server_id, 'RESCUE')
self.addCleanup(self._unrescue, self.server_id)
# Attach the volume to the server
@@ -150,7 +156,8 @@
# Rescue the server
self.servers_client.rescue_server(self.server_id,
adminPass=self.password)
- self.servers_client.wait_for_server_status(self.server_id, 'RESCUE')
+ waiters.wait_for_server_status(self.servers_client,
+ self.server_id, 'RESCUE')
# addCleanup is a LIFO queue
self.addCleanup(self._detach, self.server_id, volume['id'])
self.addCleanup(self._unrescue, self.server_id)
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index a7ebc09..2c1e69c 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -15,6 +15,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import test
@@ -66,7 +67,7 @@
self.addCleanup(self.keypairs_client.delete_keypair, key_name)
self.keypairs_client.list_keypairs()
server = self.create_test_server(key_name=key_name)
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
server = self.client.show_server(server['id'])
self.assertEqual(key_name, server['key_name'])
@@ -76,7 +77,7 @@
# Update the server with a new name
self.client.update_server(server_id,
name=new_name)
- self.client.wait_for_server_status(server_id, status)
+ waiters.wait_for_server_status(self.client, server_id, status)
# Verify the name of the server has changed
server = self.client.show_server(server_id)
@@ -95,7 +96,7 @@
# The server name should be changed to the the provided value
server = self.create_test_server(wait_until='ACTIVE')
self.client.stop(server['id'])
- self.client.wait_for_server_status(server['id'], 'SHUTOFF')
+ waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
updated_server = self._update_server_name(server['id'], 'SHUTOFF')
self.assertNotIn('progress', updated_server)
@@ -108,7 +109,7 @@
self.client.update_server(server['id'],
accessIPv4='1.1.1.1',
accessIPv6='::babe:202:202')
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
# Verify the access addresses have been updated
server = self.client.show_server(server['id'])
@@ -119,6 +120,6 @@
def test_create_server_with_ipv6_addr_only(self):
# Create a server without an IPv4 address(only IPv6 address).
server = self.create_test_server(accessIPv6='2001:2001::3')
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
server = self.client.show_server(server['id'])
self.assertEqual('2001:2001::3', server['accessIPv6'])
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index d13d9d6..fe05456 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -20,6 +20,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -33,7 +34,8 @@
def setUp(self):
super(ServersNegativeTestJSON, self).setUp()
try:
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'ACTIVE')
except Exception:
self.__class__.server_id = self.rebuild_server(self.server_id)
@@ -157,7 +159,7 @@
def test_pause_paused_server(self):
# Pause a paused server.
self.client.pause_server(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'PAUSED')
+ waiters.wait_for_server_status(self.client, self.server_id, 'PAUSED')
self.assertRaises(lib_exc.Conflict,
self.client.pause_server,
self.server_id)
@@ -384,7 +386,8 @@
def test_suspend_server_invalid_state(self):
# suspend a suspended server.
self.client.suspend_server(self.server_id)
- self.client.wait_for_server_status(self.server_id, 'SUSPENDED')
+ waiters.wait_for_server_status(self.client, self.server_id,
+ 'SUSPENDED')
self.assertRaises(lib_exc.Conflict,
self.client.suspend_server,
self.server_id)
@@ -465,12 +468,14 @@
offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
- self.client.wait_for_server_status(self.server_id,
- 'SHELVED_OFFLOADED',
- extra_timeout=offload_time)
+ waiters.wait_for_server_status(self.client,
+ self.server_id,
+ 'SHELVED_OFFLOADED',
+ extra_timeout=offload_time)
else:
- self.client.wait_for_server_status(self.server_id,
- 'SHELVED')
+ waiters.wait_for_server_status(self.client,
+ self.server_id,
+ 'SHELVED')
server = self.client.show_server(self.server_id)
image_name = server['name'] + '-shelved'
diff --git a/tempest/api/compute/test_live_block_migration_negative.py b/tempest/api/compute/test_live_block_migration_negative.py
index 47251b2..fabe55d 100644
--- a/tempest/api/compute/test_live_block_migration_negative.py
+++ b/tempest/api/compute/test_live_block_migration_negative.py
@@ -17,6 +17,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -55,4 +56,5 @@
self.assertRaises(lib_exc.BadRequest, self._migrate_server_to,
server_id, target_host)
- self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, server_id,
+ 'ACTIVE')
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 580fb84..0496063 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -17,6 +17,7 @@
from tempest.api.compute import base
from tempest.common.utils.linux import remote_client
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -93,11 +94,12 @@
self._create_and_attach()
self.servers_client.stop(self.server['id'])
- self.servers_client.wait_for_server_status(self.server['id'],
- 'SHUTOFF')
+ waiters.wait_for_server_status(self.servers_client, self.server['id'],
+ 'SHUTOFF')
self.servers_client.start(self.server['id'])
- self.servers_client.wait_for_server_status(self.server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, self.server['id'],
+ 'ACTIVE')
linux_client = remote_client.RemoteClient(self.server,
self.image_ssh_user,
@@ -108,11 +110,12 @@
self._detach(self.server['id'], self.volume['id'])
self.attachment = None
self.servers_client.stop(self.server['id'])
- self.servers_client.wait_for_server_status(self.server['id'],
- 'SHUTOFF')
+ waiters.wait_for_server_status(self.servers_client, self.server['id'],
+ 'SHUTOFF')
self.servers_client.start(self.server['id'])
- self.servers_client.wait_for_server_status(self.server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, self.server['id'],
+ 'ACTIVE')
linux_client = remote_client.RemoteClient(self.server,
self.image_ssh_user,
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 50671d0..78b51c8 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -270,33 +270,57 @@
@test.idempotent_id('c86ac3a8-50bd-4b00-a6b8-62af84a0765c')
@test.requires_ext(extension='extraroute', service='network')
def test_update_extra_route(self):
- self.network = self.create_network()
- self.name = self.network['name']
- self.subnet = self.create_subnet(self.network)
- # Add router interface with subnet id
+ # Create different cidr for each subnet to avoid cidr duplicate
+ # The cidr starts from tenant_cidr
+ next_cidr = netaddr.IPNetwork(self.tenant_cidr)
+ # Prepare to build several routes
+ test_routes = []
+ routes_num = 5
+ # Create a router
self.router = self._create_router(
data_utils.rand_name('router-'), True)
- self.create_router_interface(self.router['id'], self.subnet['id'])
self.addCleanup(
self._delete_extra_routes,
self.router['id'])
# Update router extra route, second ip of the range is
# used as next hop
- cidr = netaddr.IPNetwork(self.subnet['cidr'])
- next_hop = str(cidr[2])
- destination = str(self.subnet['cidr'])
+ for i in range(routes_num):
+ network = self.create_network()
+ subnet = self.create_subnet(network, cidr=next_cidr)
+ next_cidr = next_cidr.next()
+
+ # Add router interface with subnet id
+ self.create_router_interface(self.router['id'], subnet['id'])
+
+ cidr = netaddr.IPNetwork(subnet['cidr'])
+ next_hop = str(cidr[2])
+ destination = str(subnet['cidr'])
+ test_routes.append(
+ {'nexthop': next_hop, 'destination': destination}
+ )
+
+ test_routes.sort(key=lambda x: x['destination'])
extra_route = self.client.update_extra_routes(self.router['id'],
- next_hop, destination)
- self.assertEqual(1, len(extra_route['router']['routes']))
- self.assertEqual(destination,
- extra_route['router']['routes'][0]['destination'])
- self.assertEqual(next_hop,
- extra_route['router']['routes'][0]['nexthop'])
+ test_routes)
show_body = self.client.show_router(self.router['id'])
- self.assertEqual(destination,
- show_body['router']['routes'][0]['destination'])
- self.assertEqual(next_hop,
- show_body['router']['routes'][0]['nexthop'])
+ # Assert the number of routes
+ self.assertEqual(routes_num, len(extra_route['router']['routes']))
+ self.assertEqual(routes_num, len(show_body['router']['routes']))
+
+ routes = extra_route['router']['routes']
+ routes.sort(key=lambda x: x['destination'])
+ # Assert the nexthops & destination
+ for i in range(routes_num):
+ self.assertEqual(test_routes[i]['destination'],
+ routes[i]['destination'])
+ self.assertEqual(test_routes[i]['nexthop'], routes[i]['nexthop'])
+
+ routes = show_body['router']['routes']
+ routes.sort(key=lambda x: x['destination'])
+ for i in range(routes_num):
+ self.assertEqual(test_routes[i]['destination'],
+ routes[i]['destination'])
+ self.assertEqual(test_routes[i]['nexthop'], routes[i]['nexthop'])
def _delete_extra_routes(self, router_id):
self.client.delete_extra_routes(router_id)
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 0ebcf3a..067c0c1 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -15,6 +15,7 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import test
import testtools
@@ -37,7 +38,8 @@
# Create a test shared instance
srv_name = data_utils.rand_name(cls.__name__ + '-Instance')
cls.server = cls.create_server(srv_name)
- cls.servers_client.wait_for_server_status(cls.server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(cls.servers_client, cls.server['id'],
+ 'ACTIVE')
# Create a test shared volume for attach/detach tests
cls.volume = cls.create_volume()
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 9269cfb..5203444 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -19,6 +19,7 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import test
@@ -183,7 +184,8 @@
self.addCleanup(self.servers_client.wait_for_server_termination,
server['id'])
self.addCleanup(self.servers_client.delete_server, server['id'])
- self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'ACTIVE')
self.assertRaises(lib_exc.NotFound,
self.client.attach_volume,
str(uuid.uuid4()),
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 340f019..1df1896 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -14,6 +14,7 @@
from tempest.api.volume import base
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -70,7 +71,8 @@
server_name = data_utils.rand_name('instance')
server = self.create_server(server_name)
self.addCleanup(self.servers_client.delete_server, server['id'])
- self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'ACTIVE')
mountpoint = '/dev/%s' % CONF.compute.volume_device_name
self.servers_client.attach_volume(
server['id'], self.volume_origin['id'], mountpoint)
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
index 5de4b0e..06e3493 100644
--- a/tempest/common/compute.py
+++ b/tempest/common/compute.py
@@ -18,6 +18,7 @@
from tempest_lib.common.utils import data_utils
from tempest.common import fixed_network
+from tempest.common import waiters
from tempest import config
CONF = config.CONF
@@ -98,8 +99,8 @@
if 'wait_until' in kwargs:
for server in servers:
try:
- clients.servers_client.wait_for_server_status(
- server['id'], kwargs['wait_until'])
+ waiters.wait_for_server_status(
+ clients.servers_client, server['id'], kwargs['wait_until'])
# Multiple validatable servers are not supported for now. Their
# creation will fail with the condition above (l.58).
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 2102638..ff4eda9 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -51,11 +51,21 @@
def create_project(self, name, description):
pass
- def assign_user_role(self, user, project, role_name):
+ def _check_role_exists(self, role_name):
try:
roles = self._list_roles()
role = next(r for r in roles if r['name'] == role_name)
except StopIteration:
+ return None
+ return role
+
+ def create_user_role(self, role_name):
+ if not self._check_role_exists(role_name):
+ self.identity_client.create_role(role_name)
+
+ def assign_user_role(self, user, project, role_name):
+ role = self._check_role_exists(role_name)
+ if not role:
msg = 'No "%s" role found' % role_name
raise lib_exc.NotFound(msg)
try:
@@ -196,16 +206,27 @@
email = data_utils.rand_name(root) + suffix + "@example.com"
user = self.creds_client.create_user(
username, user_password, project, email)
+ role_assigned = False
if admin:
self.creds_client.assign_user_role(user, project,
CONF.identity.admin_role)
+ role_assigned = True
# Add roles specified in config file
for conf_role in CONF.auth.tempest_roles:
self.creds_client.assign_user_role(user, project, conf_role)
+ role_assigned = True
# Add roles requested by caller
if roles:
for role in roles:
self.creds_client.assign_user_role(user, project, role)
+ role_assigned = True
+ # NOTE(mtreinish) For a user to have access to a project with v3 auth
+ # it must beassigned a role on the project. So we need to ensure that
+ # our newly created user has a role on the newly created project.
+ if self.identity_version == 'v3' and not role_assigned:
+ self.creds_client.create_user_role('Member')
+ self.creds_client.assign_user_role(user, project, 'Member')
+
creds = self.creds_client.get_credentials(user, project, user_password)
return cred_provider.TestResources(creds)
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 95a8356..03e572f 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -25,6 +25,7 @@
from tempest.common import fixed_network
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
+from tempest.common import waiters
from tempest import config
from tempest import exceptions
from tempest.services.network import resources as net_resources
@@ -177,8 +178,9 @@
cleanup_callable=self.delete_wrapper,
cleanup_args=[self.servers_client.delete_server, server['id']])
if wait_on_boot:
- self.servers_client.wait_for_server_status(server_id=server['id'],
- status='ACTIVE')
+ waiters.wait_for_server_status(self.servers_client,
+ server_id=server['id'],
+ status='ACTIVE')
# The instance retrieved on creation is missing network
# details, necessitating retrieval after it becomes active to
# ensure correct details.
@@ -443,7 +445,8 @@
preserve_ephemeral=preserve_ephemeral,
**rebuild_kwargs)
if wait:
- self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client,
+ server_id, 'ACTIVE')
def ping_ip_address(self, ip_address, should_succeed=True,
ping_timeout=None):
@@ -1226,8 +1229,8 @@
BaremetalProvisionStates.ACTIVE,
timeout=CONF.baremetal.active_timeout)
- self.servers_client.wait_for_server_status(self.instance['id'],
- 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client,
+ self.instance['id'], 'ACTIVE')
self.node = self.get_node(instance_id=self.instance['id'])
self.instance = self.servers_client.show_server(self.instance['id'])
diff --git a/tempest/scenario/test_baremetal_basic_ops.py b/tempest/scenario/test_baremetal_basic_ops.py
index 9fdba39..346f56b 100644
--- a/tempest/scenario/test_baremetal_basic_ops.py
+++ b/tempest/scenario/test_baremetal_basic_ops.py
@@ -15,6 +15,7 @@
from oslo_log import log as logging
+from tempest.common import waiters
from tempest import config
from tempest.scenario import manager
from tempest import test
@@ -52,11 +53,13 @@
self.assertEqual(self.node['uuid'], node['uuid'])
self.node = node
- self.servers_client.wait_for_server_status(
+ waiters.wait_for_server_status(
+ self.servers_client,
server_id=self.instance['id'],
status='REBUILD',
ready_wait=False)
- self.servers_client.wait_for_server_status(
+ waiters.wait_for_server_status(
+ self.servers_client,
server_id=self.instance['id'],
status='ACTIVE')
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index 1a18be5..fa70d3f 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -18,6 +18,7 @@
from tempest.common import fixed_network
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest.scenario import manager
from tempest import test
@@ -76,7 +77,8 @@
for server in self.servers:
# Make sure nova list keeps working throughout the build process
self.servers_client.list_servers()
- self.servers_client.wait_for_server_status(server['id'], status)
+ waiters.wait_for_server_status(self.servers_client,
+ server['id'], status)
def nova_boot(self):
name = data_utils.rand_name('scenario-server')
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 9c3c25d..f868382 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -16,6 +16,7 @@
from oslo_log import log as logging
from tempest.common import custom_matchers
+from tempest.common import waiters
from tempest import config
from tempest import exceptions
from tempest.scenario import manager
@@ -43,7 +44,8 @@
server_id = self.server['id']
# Raise on error defaults to True, which is consistent with the
# original function from scenario tests here
- self.servers_client.wait_for_server_status(server_id, status)
+ waiters.wait_for_server_status(self.servers_client,
+ server_id, status)
def nova_keypair_add(self):
self.keypair = self.create_keypair()
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index c864379..3d233d8 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -17,6 +17,7 @@
import testtools
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest.scenario import manager
from tempest import test
@@ -90,7 +91,8 @@
servers=[self.server])
def _wait_server_status_and_check_network_connectivity(self):
- self.servers_client.wait_for_server_status(self.server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client,
+ self.server['id'], 'ACTIVE')
self._check_network_connectivity()
@test.idempotent_id('61f1aa9a-1573-410e-9054-afa557cab021')
@@ -99,8 +101,8 @@
def test_server_connectivity_stop_start(self):
self._setup_network_and_servers()
self.servers_client.stop(self.server['id'])
- self.servers_client.wait_for_server_status(self.server['id'],
- 'SHUTOFF')
+ waiters.wait_for_server_status(self.servers_client,
+ self.server['id'], 'SHUTOFF')
self._check_network_connectivity(should_connect=False)
self.servers_client.start(self.server['id'])
self._wait_server_status_and_check_network_connectivity()
@@ -128,7 +130,8 @@
def test_server_connectivity_pause_unpause(self):
self._setup_network_and_servers()
self.servers_client.pause_server(self.server['id'])
- self.servers_client.wait_for_server_status(self.server['id'], 'PAUSED')
+ waiters.wait_for_server_status(self.servers_client,
+ self.server['id'], 'PAUSED')
self._check_network_connectivity(should_connect=False)
self.servers_client.unpause_server(self.server['id'])
self._wait_server_status_and_check_network_connectivity()
@@ -140,8 +143,8 @@
def test_server_connectivity_suspend_resume(self):
self._setup_network_and_servers()
self.servers_client.suspend_server(self.server['id'])
- self.servers_client.wait_for_server_status(self.server['id'],
- 'SUSPENDED')
+ waiters.wait_for_server_status(self.servers_client, self.server['id'],
+ 'SUSPENDED')
self._check_network_connectivity(should_connect=False)
self.servers_client.resume_server(self.server['id'])
self._wait_server_status_and_check_network_connectivity()
@@ -157,7 +160,7 @@
raise self.skipException(msg)
self._setup_network_and_servers()
self.servers_client.resize(self.server['id'], flavor_ref=resize_flavor)
- self.servers_client.wait_for_server_status(self.server['id'],
- 'VERIFY_RESIZE')
+ waiters.wait_for_server_status(self.servers_client, self.server['id'],
+ 'VERIFY_RESIZE')
self.servers_client.confirm_resize(self.server['id'])
self._wait_server_status_and_check_network_connectivity()
diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py
index 04d5c8b..e405cf5 100644
--- a/tempest/scenario/test_server_advanced_ops.py
+++ b/tempest/scenario/test_server_advanced_ops.py
@@ -16,6 +16,7 @@
from oslo_log import log as logging
import testtools
+from tempest.common import waiters
from tempest import config
from tempest.scenario import manager
from tempest import test
@@ -58,14 +59,14 @@
LOG.debug("Resizing instance %s from flavor %s to flavor %s",
instance['id'], instance['flavor']['id'], resize_flavor)
self.servers_client.resize(instance_id, resize_flavor)
- self.servers_client.wait_for_server_status(instance_id,
- 'VERIFY_RESIZE')
+ waiters.wait_for_server_status(self.servers_client, instance_id,
+ 'VERIFY_RESIZE')
LOG.debug("Confirming resize of instance %s", instance_id)
self.servers_client.confirm_resize(instance_id)
- self.servers_client.wait_for_server_status(instance_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, instance_id,
+ 'ACTIVE')
@test.idempotent_id('949da7d5-72c8-4808-8802-e3d70df98e2c')
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
@@ -78,23 +79,23 @@
LOG.debug("Suspending instance %s. Current status: %s",
instance_id, instance['status'])
self.servers_client.suspend_server(instance_id)
- self.servers_client.wait_for_server_status(instance_id,
- 'SUSPENDED')
+ waiters.wait_for_server_status(self.servers_client, instance_id,
+ 'SUSPENDED')
fetched_instance = self.servers_client.show_server(instance_id)
LOG.debug("Resuming instance %s. Current status: %s",
instance_id, fetched_instance['status'])
self.servers_client.resume_server(instance_id)
- self.servers_client.wait_for_server_status(instance_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, instance_id,
+ 'ACTIVE')
fetched_instance = self.servers_client.show_server(instance_id)
LOG.debug("Suspending instance %s. Current status: %s",
instance_id, fetched_instance['status'])
self.servers_client.suspend_server(instance_id)
- self.servers_client.wait_for_server_status(instance_id,
- 'SUSPENDED')
+ waiters.wait_for_server_status(self.servers_client, instance_id,
+ 'SUSPENDED')
fetched_instance = self.servers_client.show_server(instance_id)
LOG.debug("Resuming instance %s. Current status: %s",
instance_id, fetched_instance['status'])
self.servers_client.resume_server(instance_id)
- self.servers_client.wait_for_server_status(instance_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, instance_id,
+ 'ACTIVE')
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index e674101..02ee7b9 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -16,6 +16,7 @@
from oslo_log import log
import testtools
+from tempest.common import waiters
from tempest import config
from tempest.scenario import manager
from tempest import test
@@ -50,15 +51,18 @@
self.servers_client.shelve_server(server['id'])
offload_time = CONF.compute.shelved_offload_time
if offload_time >= 0:
- self.servers_client.wait_for_server_status(
- server['id'], 'SHELVED_OFFLOADED', extra_timeout=offload_time)
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'SHELVED_OFFLOADED',
+ extra_timeout=offload_time)
else:
- self.servers_client.wait_for_server_status(server['id'], 'SHELVED')
+ waiters.wait_for_server_status(self.servers_client,
+ server['id'], 'SHELVED')
self.servers_client.shelve_offload_server(server['id'])
- self.servers_client.wait_for_server_status(server['id'],
- 'SHELVED_OFFLOADED')
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'SHELVED_OFFLOADED')
self.servers_client.unshelve_server(server['id'])
- self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'ACTIVE')
@test.idempotent_id('1164e700-0af0-4a4c-8792-35909a88743c')
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 102e9a3..45b7b74 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -13,6 +13,7 @@
from oslo_log import log
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest.scenario import manager
from tempest import test
@@ -85,7 +86,8 @@
for i in instances:
self.servers_client.stop(i['id'])
for i in instances:
- self.servers_client.wait_for_server_status(i['id'], 'SHUTOFF')
+ waiters.wait_for_server_status(self.servers_client,
+ i['id'], 'SHUTOFF')
def _detach_volumes(self, volumes):
# NOTE(gfidente): two loops so we do not wait for the status twice
diff --git a/tempest/services/compute/json/agents_client.py b/tempest/services/compute/json/agents_client.py
index 525946e..1269991 100644
--- a/tempest/services/compute/json/agents_client.py
+++ b/tempest/services/compute/json/agents_client.py
@@ -24,7 +24,7 @@
Tests Agents API
"""
- def list_agents(self, params=None):
+ def list_agents(self, **params):
"""List all agent builds."""
url = 'os-agents'
if params:
diff --git a/tempest/services/compute/json/baremetal_nodes_client.py b/tempest/services/compute/json/baremetal_nodes_client.py
index 20be790..8165292 100644
--- a/tempest/services/compute/json/baremetal_nodes_client.py
+++ b/tempest/services/compute/json/baremetal_nodes_client.py
@@ -25,7 +25,7 @@
Tests Baremetal API
"""
- def list_baremetal_nodes(self, params=None):
+ def list_baremetal_nodes(self, **params):
"""List all baremetal nodes."""
url = 'os-baremetal-nodes'
if params:
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 8923d64..2193949 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -23,7 +23,7 @@
class FloatingIPsClient(service_client.ServiceClient):
- def list_floating_ips(self, params=None):
+ def list_floating_ips(self, **params):
"""Returns a list of all floating IPs filtered by any parameters."""
url = 'os-floating-ips'
if params:
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index d597a06..752af68 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -21,7 +21,7 @@
class HostsClient(service_client.ServiceClient):
- def list_hosts(self, params=None):
+ def list_hosts(self, **params):
"""Lists all hosts."""
url = 'os-hosts'
diff --git a/tempest/services/compute/json/migrations_client.py b/tempest/services/compute/json/migrations_client.py
index 2a2bcd2..06c8f13 100644
--- a/tempest/services/compute/json/migrations_client.py
+++ b/tempest/services/compute/json/migrations_client.py
@@ -21,7 +21,7 @@
class MigrationsClient(service_client.ServiceClient):
- def list_migrations(self, params=None):
+ def list_migrations(self, **params):
"""Lists all migrations."""
url = 'os-migrations'
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index bee8d41..5a3d771 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -23,7 +23,7 @@
class SecurityGroupsClient(service_client.ServiceClient):
- def list_security_groups(self, params=None):
+ def list_security_groups(self, **params):
"""List all security groups for a user."""
url = 'os-security-groups'
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 90ebb9b..1159a58 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -22,7 +22,6 @@
from tempest.api_schema.response.compute.v2_1 import servers as schema
from tempest.common import service_client
-from tempest.common import waiters
from tempest import exceptions
@@ -166,14 +165,6 @@
self.validate_response(_schema, resp, body)
return service_client.ResponseBody(resp, body)
- def wait_for_server_status(self, server_id, status, extra_timeout=0,
- raise_on_error=True, ready_wait=True):
- """Waits for a server to reach a given status."""
- return waiters.wait_for_server_status(self, server_id, status,
- extra_timeout=extra_timeout,
- raise_on_error=raise_on_error,
- ready_wait=ready_wait)
-
def wait_for_server_termination(self, server_id, ignore_error=False):
"""Waits for server to reach termination."""
start_time = int(time.time())
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
index e1b48bb..699d3e7 100644
--- a/tempest/services/compute/json/services_client.py
+++ b/tempest/services/compute/json/services_client.py
@@ -23,7 +23,7 @@
class ServicesClient(service_client.ServiceClient):
- def list_services(self, params=None):
+ def list_services(self, **params):
url = 'os-services'
if params:
url += '?%s' % urllib.urlencode(params)
diff --git a/tempest/services/compute/json/tenant_usages_client.py b/tempest/services/compute/json/tenant_usages_client.py
index cd9f3b6..72fcde2 100644
--- a/tempest/services/compute/json/tenant_usages_client.py
+++ b/tempest/services/compute/json/tenant_usages_client.py
@@ -22,7 +22,7 @@
class TenantUsagesClient(service_client.ServiceClient):
- def list_tenant_usages(self, params=None):
+ def list_tenant_usages(self, **params):
url = 'os-simple-tenant-usage'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -32,7 +32,7 @@
self.validate_response(schema.list_tenant_usage, resp, body)
return service_client.ResponseBodyList(resp, body['tenant_usages'][0])
- def show_tenant_usage(self, tenant_id, params=None):
+ def show_tenant_usage(self, tenant_id, **params):
url = 'os-simple-tenant-usage/%s' % tenant_id
if params:
url += '?%s' % urllib.urlencode(params)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index aa0c583..65f3aa7 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -594,12 +594,11 @@
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def update_extra_routes(self, router_id, nexthop, destination):
+ def update_extra_routes(self, router_id, routes):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
put_body = {
'router': {
- 'routes': [{'nexthop': nexthop,
- "destination": destination}]
+ 'routes': routes
}
}
body = json.dumps(put_body)
diff --git a/tempest/stress/actions/server_create_destroy.py b/tempest/stress/actions/server_create_destroy.py
index d0e4eea..9f41526 100644
--- a/tempest/stress/actions/server_create_destroy.py
+++ b/tempest/stress/actions/server_create_destroy.py
@@ -13,6 +13,7 @@
# limitations under the License.
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
import tempest.stress.stressaction as stressaction
@@ -31,8 +32,8 @@
server = self.manager.servers_client.create_server(
name, self.image, self.flavor)
server_id = server['id']
- self.manager.servers_client.wait_for_server_status(server_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(self.manager.servers_client, server_id,
+ 'ACTIVE')
self.logger.info("created %s" % server_id)
self.logger.info("deleting %s" % name)
self.manager.servers_client.delete_server(server_id)
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index 9e540fa..4a27466 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -14,6 +14,7 @@
import subprocess
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
import tempest.stress.stressaction as stressaction
import tempest.test
@@ -79,8 +80,8 @@
**vm_args)
self.server_id = server['id']
if self.wait_after_vm_create:
- self.manager.servers_client.wait_for_server_status(self.server_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(self.manager.servers_client,
+ self.server_id, 'ACTIVE')
def _destroy_vm(self):
self.logger.info("deleting %s" % self.server_id)
@@ -172,8 +173,8 @@
self._create_vm()
if self.reboot:
self.manager.servers_client.reboot(self.server_id, 'HARD')
- self.manager.servers_client.wait_for_server_status(self.server_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(self.manager.servers_client,
+ self.server_id, 'ACTIVE')
self.run_core()
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
index a5e393f..d6965c7 100644
--- a/tempest/stress/actions/volume_attach_delete.py
+++ b/tempest/stress/actions/volume_attach_delete.py
@@ -12,6 +12,7 @@
# limitations under the License.
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
import tempest.stress.stressaction as stressaction
@@ -40,7 +41,8 @@
server = self.manager.servers_client.create_server(
vm_name, self.image, self.flavor)
server_id = server['id']
- self.manager.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ waiters.wait_for_server_status(self.manager.servers_client, server_id,
+ 'ACTIVE')
self.logger.info("created vm %s" % server_id)
# Step 3: attach volume to vm
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index 1cd96ed..3ba2a91 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -14,6 +14,7 @@
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
+from tempest.common import waiters
from tempest import config
import tempest.stress.stressaction as stressaction
import tempest.test
@@ -41,8 +42,8 @@
self.flavor,
**vm_args)
self.server_id = server['id']
- self.manager.servers_client.wait_for_server_status(self.server_id,
- 'ACTIVE')
+ waiters.wait_for_server_status(self.manager.servers_client,
+ self.server_id, 'ACTIVE')
def _destroy_vm(self):
self.logger.info("deleting server: %s" % self.server_id)
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index d9b430e..b785156 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -47,7 +47,7 @@
pass
secgrp_client = admin_manager.security_groups_client
- secgrp = secgrp_client.list_security_groups({"all_tenants": True})
+ secgrp = secgrp_client.list_security_groups(all_tenants=True)
secgrp_del = [grp for grp in secgrp if grp['name'] != 'default']
LOG.info("Cleanup::remove %s Security Group" % len(secgrp_del))
for g in secgrp_del:
diff --git a/tempest/test_discover/plugins.py b/tempest/test_discover/plugins.py
index d5273d5..2701f02 100644
--- a/tempest/test_discover/plugins.py
+++ b/tempest/test_discover/plugins.py
@@ -13,12 +13,16 @@
# under the License.
import abc
+import logging
import six
import stevedore
from tempest_lib.common.utils import misc
+LOG = logging.getLogger(__name__)
+
+
@six.add_metaclass(abc.ABCMeta)
class TempestPlugin(object):
"""A TempestPlugin class provides the basic hooks for an external
@@ -47,7 +51,13 @@
def __init__(self):
self.ext_plugins = stevedore.ExtensionManager(
'tempest.test_plugins', invoke_on_load=True,
- propagate_map_exceptions=True)
+ propagate_map_exceptions=True,
+ on_load_failure_callback=self.failure_hook)
+
+ @staticmethod
+ def failure_hook(_, ep, err):
+ LOG.error('Could not load %r: %s', ep.name, err)
+ raise err
def get_plugin_load_tests_tuple(self):
load_tests_dict = {}
diff --git a/tempest/test_discover/test_discover.py b/tempest/test_discover/test_discover.py
index 86aa855..dac7d91 100644
--- a/tempest/test_discover/test_discover.py
+++ b/tempest/test_discover/test_discover.py
@@ -48,8 +48,8 @@
for plugin in plugin_load_tests:
test_dir, top_path = plugin_load_tests[plugin]
if not pattern:
- suite.addTests(loader.discover(test_dir, top_level=top_path))
+ suite.addTests(loader.discover(test_dir, top_level_dir=top_path))
else:
suite.addTests(loader.discover(test_dir, pattern=pattern,
- top_level=top_path))
+ top_level_dir=top_path))
return suite
diff --git a/tempest/tests/services/__init__.py b/tempest/tests/services/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/tests/services/__init__.py
diff --git a/tempest/tests/services/compute/__init__.py b/tempest/tests/services/compute/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/tests/services/compute/__init__.py
diff --git a/tempest/tests/services/compute/test_agents_client.py b/tempest/tests/services/compute/test_agents_client.py
new file mode 100644
index 0000000..e8ea525
--- /dev/null
+++ b/tempest/tests/services/compute/test_agents_client.py
@@ -0,0 +1,50 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import httplib2
+
+from oslotest import mockpatch
+
+from tempest.services.compute.json import agents_client
+from tempest.tests import base
+from tempest.tests import fake_auth_provider
+from tempest.tests import fake_config
+
+
+class TestAgentsClient(base.TestCase):
+
+ def setUp(self):
+ super(TestAgentsClient, self).setUp()
+ self.useFixture(fake_config.ConfigFixture())
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = agents_client.AgentsClient(fake_auth,
+ 'compute', 'regionOne')
+
+ def _test_list_agents(self, bytes_body=False):
+ if bytes_body:
+ body = bytes(b'{"agents": []}')
+ else:
+ body = '{"agents": []}'
+ expected = []
+ response = (httplib2.Response({'status': 200}), body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=response))
+ self.assertEqual(expected, self.client.list_agents())
+
+ def test_list_agents_with_str_body(self):
+ self._test_list_agents()
+
+ def test_list_agents_with_bytes_body(self):
+ self._test_list_agents(bytes_body=True)
diff --git a/test-requirements.txt b/test-requirements.txt
index 7115168..8fcf071 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -10,4 +10,4 @@
mock>=1.1;python_version!='2.6'
mock==1.0.1;python_version=='2.6'
coverage>=3.6
-oslotest>=1.5.1 # Apache-2.0
+oslotest>=1.7.0 # Apache-2.0