Merge "Merge the separated link lines on compute client"
diff --git a/HACKING.rst b/HACKING.rst
index 7ab420b..a209b3f 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -240,29 +240,6 @@
can be used to perform this. See AggregatesAdminTest in
tempest.api.compute.admin for an example of using locking.
-Stress Tests in Tempest
------------------------
-Any tempest test case can be flagged as a stress test. With this flag it will
-be automatically discovery and used in the stress test runs. The stress test
-framework itself is a facility to spawn and control worker processes in order
-to find race conditions (see ``tempest/stress/`` for more information). Please
-note that these stress tests can't be used for benchmarking purposes since they
-don't measure any performance characteristics.
-
-Example::
-
- @stresstest(class_setup_per='process')
- def test_this_and_that(self):
- ...
-
-This will flag the test ``test_this_and_that`` as a stress test. The parameter
-``class_setup_per`` gives control when the setUpClass function should be called.
-
-Good candidates for stress tests are:
-
-- Scenario tests
-- API tests that have a wide focus
-
Sample Configuration File
-------------------------
The sample config file is autogenerated using a script. If any changes are made
diff --git a/doc/source/field_guide/stress.rst b/doc/source/field_guide/stress.rst
deleted file mode 120000
index d39d0f8..0000000
--- a/doc/source/field_guide/stress.rst
+++ /dev/null
@@ -1 +0,0 @@
-../../../tempest/stress/README.rst
\ No newline at end of file
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 6abe9dc..896cd98 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -24,7 +24,6 @@
field_guide/index
field_guide/api
field_guide/scenario
- field_guide/stress
field_guide/unit_tests
=========
diff --git a/etc/logging.conf.sample b/etc/logging.conf.sample
index 36cd324..c131b07 100644
--- a/etc/logging.conf.sample
+++ b/etc/logging.conf.sample
@@ -1,5 +1,5 @@
[loggers]
-keys=root,tempest_stress
+keys=root
[handlers]
keys=file,devel,syslog
@@ -11,11 +11,6 @@
level=DEBUG
handlers=file
-[logger_tempest_stress]
-level=DEBUG
-handlers=file,devel
-qualname=tempest.stress
-
[handler_file]
class=FileHandler
level=DEBUG
diff --git a/releasenotes/notes/add-error-code-translation-to-versions-clients-acbc78292e24b014.yaml b/releasenotes/notes/add-error-code-translation-to-versions-clients-acbc78292e24b014.yaml
new file mode 100644
index 0000000..57bf47c
--- /dev/null
+++ b/releasenotes/notes/add-error-code-translation-to-versions-clients-acbc78292e24b014.yaml
@@ -0,0 +1,6 @@
+---
+upgrade:
+ - Add an error translation to list_versions() of versions_client of both
+ compute and network. This can affect users who are expecting that these
+ clients return error status code instead of the exception. It is needed
+ to change the code for handling the exception like the other clients code.
diff --git a/releasenotes/notes/remo-stress-tests-81052b211ad95d2e.yaml b/releasenotes/notes/remo-stress-tests-81052b211ad95d2e.yaml
new file mode 100644
index 0000000..aa3a78e
--- /dev/null
+++ b/releasenotes/notes/remo-stress-tests-81052b211ad95d2e.yaml
@@ -0,0 +1,4 @@
+---
+upgrade:
+ - The Stress tests framework and all the stress tests have been removed.
+
diff --git a/requirements.txt b/requirements.txt
index fa6c413..9079a8d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -12,7 +12,7 @@
oslo.config>=3.14.0 # Apache-2.0
oslo.log>=3.11.0 # Apache-2.0
oslo.serialization>=1.10.0 # Apache-2.0
-oslo.utils>=3.16.0 # Apache-2.0
+oslo.utils>=3.17.0 # Apache-2.0
six>=1.9.0 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD
PyYAML>=3.10.0 # MIT
diff --git a/setup.cfg b/setup.cfg
index 28e17ef..96313fd 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -28,7 +28,6 @@
[entry_points]
console_scripts =
verify-tempest-config = tempest.cmd.verify_tempest_config:main
- run-tempest-stress = tempest.cmd.run_stress:main
tempest-account-generator = tempest.cmd.account_generator:main
tempest = tempest.cmd.main:main
skip-tracker = tempest.lib.cmd.skip_tracker:main
@@ -38,7 +37,6 @@
account-generator = tempest.cmd.account_generator:TempestAccountGenerator
init = tempest.cmd.init:TempestInit
cleanup = tempest.cmd.cleanup:TempestCleanup
- run-stress = tempest.cmd.run_stress:TempestRunStress
list-plugins = tempest.cmd.list_plugins:TempestListPlugins
verify-config = tempest.cmd.verify_tempest_config:TempestVerifyConfig
workspace = tempest.cmd.workspace:TempestWorkspace
diff --git a/tempest/README.rst b/tempest/README.rst
index c9a0491..0feec41 100644
--- a/tempest/README.rst
+++ b/tempest/README.rst
@@ -15,7 +15,6 @@
| tempest/
| api/ - API tests
| scenario/ - complex scenario tests
-| stress/ - stress tests
Each of these directories contains different types of tests. What
belongs in each directory, the rules and examples for good tests, are
@@ -46,14 +45,6 @@
but should instead use the tempest implementations of clients.
-:ref:`stress_field_guide`
--------------------------
-
-Stress tests are designed to stress an OpenStack environment by running a high
-workload against it and seeing what breaks. The stress test framework runs
-several test jobs in parallel and can run any existing test in Tempest as a
-stress job.
-
:ref:`unit_tests_field_guide`
-----------------------------
diff --git a/tempest/api/compute/admin/test_availability_zone.py b/tempest/api/compute/admin/test_availability_zone.py
index 5befa53..3470602 100644
--- a/tempest/api/compute/admin/test_availability_zone.py
+++ b/tempest/api/compute/admin/test_availability_zone.py
@@ -29,10 +29,10 @@
def test_get_availability_zone_list(self):
# List of availability zone
availability_zone = self.client.list_availability_zones()
- self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
+ self.assertGreater(len(availability_zone['availabilityZoneInfo']), 0)
@test.idempotent_id('ef726c58-530f-44c2-968c-c7bed22d5b8c')
def test_get_availability_zone_list_detail(self):
# List of availability zones and available services
availability_zone = self.client.list_availability_zones(detail=True)
- self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
+ self.assertGreater(len(availability_zone['availabilityZoneInfo']), 0)
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index a9e9644..29e1eb8 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -36,7 +36,7 @@
hosts = self.client.list_hosts()['hosts']
host = hosts[0]
hosts = self.client.list_hosts(zone=host['zone'])['hosts']
- self.assertTrue(len(hosts) >= 1)
+ self.assertGreaterEqual(len(hosts), 1)
self.assertIn(host, hosts)
@test.idempotent_id('9af3c171-fbf4-4150-a624-22109733c2a6')
@@ -58,12 +58,12 @@
hosts = self.client.list_hosts()['hosts']
hosts = [host for host in hosts if host['service'] == 'compute']
- self.assertTrue(len(hosts) >= 1)
+ self.assertGreaterEqual(len(hosts), 1)
for host in hosts:
hostname = host['host_name']
resources = self.client.show_host(hostname)['host']
- self.assertTrue(len(resources) >= 1)
+ self.assertGreaterEqual(len(resources), 1)
host_resource = resources[0]['resource']
self.assertIsNotNone(host_resource)
self.assertIsNotNone(host_resource['cpu'])
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
index 8366945..c270829 100644
--- a/tempest/api/compute/admin/test_hosts_negative.py
+++ b/tempest/api/compute/admin/test_hosts_negative.py
@@ -29,7 +29,7 @@
def _get_host_name(self):
hosts = self.client.list_hosts()['hosts']
- self.assertTrue(len(hosts) >= 1)
+ self.assertGreaterEqual(len(hosts), 1)
hostname = hosts[0]['host_name']
return hostname
diff --git a/tempest/api/compute/admin/test_hypervisor.py b/tempest/api/compute/admin/test_hypervisor.py
index 113ec40..92a9135 100644
--- a/tempest/api/compute/admin/test_hypervisor.py
+++ b/tempest/api/compute/admin/test_hypervisor.py
@@ -52,7 +52,7 @@
self.assertHypervisors(hypers)
details = self.client.show_hypervisor(hypers[0]['id'])['hypervisor']
- self.assertTrue(len(details) > 0)
+ self.assertGreater(len(details), 0)
self.assertEqual(details['hypervisor_hostname'],
hypers[0]['hypervisor_hostname'])
@@ -65,14 +65,14 @@
hostname = hypers[0]['hypervisor_hostname']
hypervisors = (self.client.list_servers_on_hypervisor(hostname)
['hypervisors'])
- self.assertTrue(len(hypervisors) > 0)
+ self.assertGreater(len(hypervisors), 0)
@test.idempotent_id('797e4f28-b6e0-454d-a548-80cc77c00816')
def test_get_hypervisor_stats(self):
# Verify the stats of the all hypervisor
stats = (self.client.show_hypervisor_statistics()
['hypervisor_statistics'])
- self.assertTrue(len(stats) > 0)
+ self.assertGreater(len(stats), 0)
@test.idempotent_id('91a50d7d-1c2b-4f24-b55a-a1fe20efca70')
def test_get_hypervisor_uptime(self):
diff --git a/tempest/api/compute/admin/test_hypervisor_negative.py b/tempest/api/compute/admin/test_hypervisor_negative.py
index 9c6df7f..220ea39 100644
--- a/tempest/api/compute/admin/test_hypervisor_negative.py
+++ b/tempest/api/compute/admin/test_hypervisor_negative.py
@@ -47,7 +47,7 @@
@test.idempotent_id('51e663d0-6b89-4817-a465-20aca0667d03')
def test_show_hypervisor_with_non_admin_user(self):
hypers = self._list_hypervisors()
- self.assertTrue(len(hypers) > 0)
+ self.assertGreater(len(hypers), 0)
self.assertRaises(
lib_exc.Forbidden,
@@ -58,7 +58,7 @@
@test.idempotent_id('2a0a3938-832e-4859-95bf-1c57c236b924')
def test_show_servers_with_non_admin_user(self):
hypers = self._list_hypervisors()
- self.assertTrue(len(hypers) > 0)
+ self.assertGreater(len(hypers), 0)
self.assertRaises(
lib_exc.Forbidden,
@@ -96,7 +96,7 @@
@test.idempotent_id('6c3461f9-c04c-4e2a-bebb-71dc9cb47df2')
def test_get_hypervisor_uptime_with_non_admin_user(self):
hypers = self._list_hypervisors()
- self.assertTrue(len(hypers) > 0)
+ self.assertGreater(len(hypers), 0)
self.assertRaises(
lib_exc.Forbidden,
@@ -133,7 +133,7 @@
@test.idempotent_id('5b6a6c79-5dc1-4fa5-9c58-9c8085948e74')
def test_search_hypervisor_with_non_admin_user(self):
hypers = self._list_hypervisors()
- self.assertTrue(len(hypers) > 0)
+ self.assertGreater(len(hypers), 0)
self.assertRaises(
lib_exc.Forbidden,
diff --git a/tempest/api/compute/images/test_images.py b/tempest/api/compute/images/test_images.py
index 3754637..154d717 100644
--- a/tempest/api/compute/images/test_images.py
+++ b/tempest/api/compute/images/test_images.py
@@ -42,11 +42,9 @@
@test.idempotent_id('aa06b52b-2db5-4807-b218-9441f75d74e3')
def test_delete_saving_image(self):
- snapshot_name = data_utils.rand_name('test-snap')
server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.servers_client.delete_server, server['id'])
image = self.create_image_from_server(server['id'],
- name=snapshot_name,
wait_until='SAVING')
self.client.delete_image(image['id'])
msg = ('The image with ID {image_id} failed to be deleted'
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index e91944f..8db094d 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -64,8 +64,6 @@
# Create a new image with invalid server id
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
- resp = {}
- resp['status'] = None
self.assertRaises(lib_exc.NotFound, self.create_image_from_server,
'!@$^&*()', name=name, meta=meta)
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 7fd23fc..6c417f1 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -19,6 +19,7 @@
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
+from tempest.lib.common.utils import test_utils
from tempest import test
CONF = config.CONF
@@ -75,6 +76,8 @@
body = self.client.create_image(self.server_id, name=name,
metadata=meta)
image_id = data_utils.parse_image_id(body.response['location'])
+ self.addCleanup(test_utils.call_and_ignore_notfound_exc,
+ self.client.delete_image, image_id)
waiters.wait_for_image_status(self.client, image_id, 'ACTIVE')
# Verify the image was created correctly
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index b936b23..a8c59ca 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -215,7 +215,7 @@
def test_create_list_show_delete_interfaces(self):
server, ifs = self._create_server_get_interfaces()
interface_count = len(ifs)
- self.assertTrue(interface_count > 0)
+ self.assertGreater(interface_count, 0)
self._check_interface(ifs[0])
try:
@@ -253,7 +253,7 @@
# Add and Remove the fixed IP to server.
server, ifs = self._create_server_get_interfaces()
interface_count = len(ifs)
- self.assertTrue(interface_count > 0)
+ self.assertGreater(interface_count, 0)
self._check_interface(ifs[0])
network_id = ifs[0]['net_id']
self.servers_client.add_fixed_ip(server['id'], networkId=network_id)
diff --git a/tempest/api/compute/servers/test_availability_zone.py b/tempest/api/compute/servers/test_availability_zone.py
index 76da317..00df86b 100644
--- a/tempest/api/compute/servers/test_availability_zone.py
+++ b/tempest/api/compute/servers/test_availability_zone.py
@@ -29,4 +29,4 @@
def test_get_availability_zone_list_with_non_admin_user(self):
# List of availability zone with non-administrator user
availability_zone = self.client.list_availability_zones()
- self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
+ self.assertGreater(len(availability_zone['availabilityZoneInfo']), 0)
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 78f0db4..a48c17b 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -142,16 +142,12 @@
self.assertEqual(self.name.lower(), hostname, msg)
@test.idempotent_id('ed20d3fb-9d1f-4329-b160-543fbd5d9811')
+ @testtools.skipUnless(
+ test.is_scheduler_filter_enabled("ServerGroupAffinityFilter"),
+ 'ServerGroupAffinityFilter is not available.')
def test_create_server_with_scheduler_hint_group(self):
# Create a server with the scheduler hint "group".
- name = data_utils.rand_name('server_group')
- policies = ['affinity']
- body = self.server_groups_client.create_server_group(
- name=name, policies=policies)['server_group']
- group_id = body['id']
- self.addCleanup(self.server_groups_client.delete_server_group,
- group_id)
-
+ group_id = self.create_test_server_group()['id']
hints = {'group': group_id}
server = self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')
@@ -268,37 +264,23 @@
flavor_base = self.flavors_client.show_flavor(
self.flavor_ref)['flavor']
- def create_flavor_with_extra_specs():
- flavor_with_eph_disk_name = data_utils.rand_name('eph_flavor')
+ def create_flavor_with_ephemeral(ephem_disk):
+ if ephem_disk > 0:
+ flavor_name = data_utils.rand_name('eph_flavor')
+ else:
+ flavor_name = data_utils.rand_name('no_eph_flavor')
flavor_with_eph_disk_id = data_utils.rand_int_id(start=1000)
ram = flavor_base['ram']
vcpus = flavor_base['vcpus']
disk = flavor_base['disk']
- # Create a flavor with extra specs
+ # Create a flavor with ephemeral disk
flavor = (self.flavor_client.
- create_flavor(name=flavor_with_eph_disk_name,
+ create_flavor(name=flavor_name,
ram=ram, vcpus=vcpus, disk=disk,
id=flavor_with_eph_disk_id,
- ephemeral=1))['flavor']
- self.addCleanup(flavor_clean_up, flavor['id'])
-
- return flavor['id']
-
- def create_flavor_without_extra_specs():
- flavor_no_eph_disk_name = data_utils.rand_name('no_eph_flavor')
- flavor_no_eph_disk_id = data_utils.rand_int_id(start=1000)
-
- ram = flavor_base['ram']
- vcpus = flavor_base['vcpus']
- disk = flavor_base['disk']
-
- # Create a flavor without extra specs
- flavor = (self.flavor_client.
- create_flavor(name=flavor_no_eph_disk_name,
- ram=ram, vcpus=vcpus, disk=disk,
- id=flavor_no_eph_disk_id))['flavor']
+ ephemeral=ephem_disk))['flavor']
self.addCleanup(flavor_clean_up, flavor['id'])
return flavor['id']
@@ -307,8 +289,8 @@
self.flavor_client.delete_flavor(flavor_id)
self.flavor_client.wait_for_resource_deletion(flavor_id)
- flavor_with_eph_disk_id = create_flavor_with_extra_specs()
- flavor_no_eph_disk_id = create_flavor_without_extra_specs()
+ flavor_with_eph_disk_id = create_flavor_with_ephemeral(ephem_disk=1)
+ flavor_no_eph_disk_id = create_flavor_with_ephemeral(ephem_disk=0)
admin_pass = self.image_ssh_password
@@ -318,7 +300,7 @@
adminPass=admin_pass,
flavor=flavor_no_eph_disk_id)
- # Get partition number of server without extra specs.
+ # Get partition number of server without ephemeral disk.
server_no_eph_disk = self.client.show_server(
server_no_eph_disk['id'])['server']
linux_client = remote_client.RemoteClient(
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index 1367629..e50881f 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -28,26 +28,50 @@
@classmethod
def resource_setup(cls):
super(InstanceActionsTestJSON, cls).resource_setup()
- server = cls.create_test_server(wait_until='ACTIVE')
- cls.request_id = server.response['x-compute-request-id']
- cls.server_id = server['id']
+ cls.server = cls.create_test_server(wait_until='ACTIVE')
+ cls.request_id = cls.server.response['x-compute-request-id']
@test.idempotent_id('77ca5cc5-9990-45e0-ab98-1de8fead201a')
def test_list_instance_actions(self):
# List actions of the provided server
- self.client.reboot_server(self.server_id, type='HARD')
- waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ self.client.reboot_server(self.server['id'], type='HARD')
+ waiters.wait_for_server_status(self.client,
+ self.server['id'], 'ACTIVE')
- body = (self.client.list_instance_actions(self.server_id)
+ body = (self.client.list_instance_actions(self.server['id'])
['instanceActions'])
- self.assertTrue(len(body) == 2, str(body))
- self.assertTrue(any([i for i in body if i['action'] == 'create']))
- self.assertTrue(any([i for i in body if i['action'] == 'reboot']))
+ self.assertEqual(len(body), 2, str(body))
+ self.assertEqual(sorted([i['action'] for i in body]),
+ ['create', 'reboot'])
@test.idempotent_id('aacc71ca-1d70-4aa5-bbf6-0ff71470e43c')
def test_get_instance_action(self):
# Get the action details of the provided server
body = self.client.show_instance_action(
- self.server_id, self.request_id)['instanceAction']
- self.assertEqual(self.server_id, body['instance_uuid'])
+ self.server['id'], self.request_id)['instanceAction']
+ self.assertEqual(self.server['id'], body['instance_uuid'])
self.assertEqual('create', body['action'])
+
+
+class InstanceActionsV221TestJSON(base.BaseV2ComputeTest):
+
+ min_microversion = '2.21'
+ max_microversion = 'latest'
+
+ @classmethod
+ def setup_clients(cls):
+ super(InstanceActionsV221TestJSON, cls).setup_clients()
+ cls.client = cls.servers_client
+
+ @test.idempotent_id('0a0f85d4-10fa-41f6-bf80-a54fb4aa2ae1')
+ def test_get_list_deleted_instance_actions(self):
+
+ # List actions of the deleted server
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.client.delete_server(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
+ body = (self.client.list_instance_actions(server['id'])
+ ['instanceActions'])
+ self.assertEqual(len(body), 2, str(body))
+ self.assertEqual(sorted([i['action'] for i in body]),
+ ['create', 'delete'])
diff --git a/tempest/api/compute/servers/test_instance_actions_negative.py b/tempest/api/compute/servers/test_instance_actions_negative.py
index 54ec6aa..33fed08 100644
--- a/tempest/api/compute/servers/test_instance_actions_negative.py
+++ b/tempest/api/compute/servers/test_instance_actions_negative.py
@@ -29,8 +29,7 @@
@classmethod
def resource_setup(cls):
super(InstanceActionsNegativeTestJSON, cls).resource_setup()
- server = cls.create_test_server(wait_until='ACTIVE')
- cls.server_id = server['id']
+ cls.server = cls.create_test_server(wait_until='ACTIVE')
@test.attr(type=['negative'])
@test.idempotent_id('67e1fce6-7ec2-45c6-92d4-0a8f1a632910')
@@ -46,4 +45,4 @@
def test_get_instance_action_invalid_request(self):
# Get the action details of the provided server with invalid request
self.assertRaises(lib_exc.NotFound, self.client.show_instance_action,
- self.server_id, '999')
+ self.server['id'], '999')
diff --git a/tempest/api/compute/servers/test_multiple_create.py b/tempest/api/compute/servers/test_multiple_create.py
index 4dd26af..9fc30f9 100644
--- a/tempest/api/compute/servers/test_multiple_create.py
+++ b/tempest/api/compute/servers/test_multiple_create.py
@@ -14,26 +14,16 @@
# under the License.
from tempest.api.compute import base
-from tempest.common.utils import data_utils
from tempest import test
class MultipleCreateTestJSON(base.BaseV2ComputeTest):
- _name = 'multiple-create-test'
-
- def _create_multiple_servers(self, **kwargs):
- # This is the right way to create_multiple servers and manage to get
- # the created servers into the servers list to be cleaned up after all.
- kwargs['name'] = kwargs.get('name', data_utils.rand_name(self._name))
- body = self.create_test_server(**kwargs)
-
- return body
@test.idempotent_id('61e03386-89c3-449c-9bb1-a06f423fd9d1')
def test_multiple_create(self):
- body = self._create_multiple_servers(wait_until='ACTIVE',
- min_count=1,
- max_count=2)
+ body = self.create_test_server(wait_until='ACTIVE',
+ min_count=1,
+ max_count=2)
# NOTE(maurosr): do status response check and also make sure that
# reservation_id is not in the response body when the request send
# contains return_reservation_id=False
@@ -41,8 +31,8 @@
@test.idempotent_id('864777fb-2f1e-44e3-b5b9-3eb6fa84f2f7')
def test_multiple_create_with_reservation_return(self):
- body = self._create_multiple_servers(wait_until='ACTIVE',
- min_count=1,
- max_count=2,
- return_reservation_id=True)
+ body = self.create_test_server(wait_until='ACTIVE',
+ min_count=1,
+ max_count=2,
+ return_reservation_id=True)
self.assertIn('reservation_id', body)
diff --git a/tempest/api/compute/servers/test_multiple_create_negative.py b/tempest/api/compute/servers/test_multiple_create_negative.py
index c4dbe23..d9fb4ca 100644
--- a/tempest/api/compute/servers/test_multiple_create_negative.py
+++ b/tempest/api/compute/servers/test_multiple_create_negative.py
@@ -14,48 +14,38 @@
# under the License.
from tempest.api.compute import base
-from tempest.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
class MultipleCreateNegativeTestJSON(base.BaseV2ComputeTest):
- _name = 'multiple-create-test'
-
- def _create_multiple_servers(self, **kwargs):
- # This is the right way to create_multiple servers and manage to get
- # the created servers into the servers list to be cleaned up after all.
- kwargs['name'] = kwargs.get('name', data_utils.rand_name(self._name))
- body = self.create_test_server(**kwargs)
-
- return body
@test.attr(type=['negative'])
@test.idempotent_id('daf29d8d-e928-4a01-9a8c-b129603f3fc0')
def test_min_count_less_than_one(self):
invalid_min_count = 0
- self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self.create_test_server,
min_count=invalid_min_count)
@test.attr(type=['negative'])
@test.idempotent_id('999aa722-d624-4423-b813-0d1ac9884d7a')
def test_min_count_non_integer(self):
invalid_min_count = 2.5
- self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self.create_test_server,
min_count=invalid_min_count)
@test.attr(type=['negative'])
@test.idempotent_id('a6f9c2ab-e060-4b82-b23c-4532cb9390ff')
def test_max_count_less_than_one(self):
invalid_max_count = 0
- self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self.create_test_server,
max_count=invalid_max_count)
@test.attr(type=['negative'])
@test.idempotent_id('9c5698d1-d7af-4c80-b971-9d403135eea2')
def test_max_count_non_integer(self):
invalid_max_count = 2.5
- self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self.create_test_server,
max_count=invalid_max_count)
@test.attr(type=['negative'])
@@ -63,6 +53,6 @@
def test_max_count_less_than_min_count(self):
min_count = 3
max_count = 2
- self.assertRaises(lib_exc.BadRequest, self._create_multiple_servers,
+ self.assertRaises(lib_exc.BadRequest, self.create_test_server,
min_count=min_count,
max_count=max_count)
diff --git a/tempest/api/compute/servers/test_server_addresses.py b/tempest/api/compute/servers/test_server_addresses.py
index 864f38f..d31b6f8 100644
--- a/tempest/api/compute/servers/test_server_addresses.py
+++ b/tempest/api/compute/servers/test_server_addresses.py
@@ -49,9 +49,9 @@
# We do not know the exact network configuration, but an instance
# should at least have a single public or private address
- self.assertTrue(len(addresses) >= 1)
+ self.assertGreaterEqual(len(addresses), 1)
for network_name, network_addresses in six.iteritems(addresses):
- self.assertTrue(len(network_addresses) >= 1)
+ self.assertGreaterEqual(len(network_addresses), 1)
for address in network_addresses:
self.assertTrue(address['addr'])
self.assertTrue(address['version'])
diff --git a/tempest/api/compute/servers/test_server_metadata.py b/tempest/api/compute/servers/test_server_metadata.py
index 9c07677..cb66e81 100644
--- a/tempest/api/compute/servers/test_server_metadata.py
+++ b/tempest/api/compute/servers/test_server_metadata.py
@@ -28,18 +28,17 @@
@classmethod
def resource_setup(cls):
super(ServerMetadataTestJSON, cls).resource_setup()
- server = cls.create_test_server(metadata={}, wait_until='ACTIVE')
- cls.server_id = server['id']
+ cls.server = cls.create_test_server(metadata={}, wait_until='ACTIVE')
def setUp(self):
super(ServerMetadataTestJSON, self).setUp()
meta = {'key1': 'value1', 'key2': 'value2'}
- self.client.set_server_metadata(self.server_id, meta)['metadata']
+ self.client.set_server_metadata(self.server['id'], meta)['metadata']
@test.idempotent_id('479da087-92b3-4dcf-aeb3-fd293b2d14ce')
def test_list_server_metadata(self):
# All metadata key/value pairs for a server should be returned
- resp_metadata = (self.client.list_server_metadata(self.server_id)
+ resp_metadata = (self.client.list_server_metadata(self.server['id'])
['metadata'])
# Verify the expected metadata items are in the list
@@ -51,12 +50,12 @@
# The server's metadata should be replaced with the provided values
# Create a new set of metadata for the server
req_metadata = {'meta2': 'data2', 'meta3': 'data3'}
- self.client.set_server_metadata(self.server_id,
+ self.client.set_server_metadata(self.server['id'],
req_metadata)['metadata']
# Verify the expected values are correct, and that the
# previous values have been removed
- resp_metadata = (self.client.list_server_metadata(self.server_id)
+ resp_metadata = (self.client.list_server_metadata(self.server['id'])
['metadata'])
self.assertEqual(resp_metadata, req_metadata)
@@ -65,10 +64,10 @@
# The server's metadata values should be updated to the
# provided values
meta = {'key1': 'alt1', 'key3': 'value3'}
- self.client.update_server_metadata(self.server_id, meta)
+ self.client.update_server_metadata(self.server['id'], meta)
# Verify the values have been updated to the proper values
- resp_metadata = (self.client.list_server_metadata(self.server_id)
+ resp_metadata = (self.client.list_server_metadata(self.server['id'])
['metadata'])
expected = {'key1': 'alt1', 'key2': 'value2', 'key3': 'value3'}
self.assertEqual(expected, resp_metadata)
@@ -78,8 +77,8 @@
# The original metadata should not be lost if empty metadata body is
# passed
meta = {}
- self.client.update_server_metadata(self.server_id, meta)
- resp_metadata = (self.client.list_server_metadata(self.server_id)
+ self.client.update_server_metadata(self.server['id'], meta)
+ resp_metadata = (self.client.list_server_metadata(self.server['id'])
['metadata'])
expected = {'key1': 'value1', 'key2': 'value2'}
self.assertEqual(expected, resp_metadata)
@@ -87,7 +86,7 @@
@test.idempotent_id('3043c57d-7e0e-49a6-9a96-ad569c265e6a')
def test_get_server_metadata_item(self):
# The value for a specific metadata key should be returned
- meta = self.client.show_server_metadata_item(self.server_id,
+ meta = self.client.show_server_metadata_item(self.server['id'],
'key2')['meta']
self.assertEqual('value2', meta['key2'])
@@ -96,10 +95,10 @@
# The item's value should be updated to the provided value
# Update the metadata value
meta = {'nova': 'alt'}
- self.client.set_server_metadata_item(self.server_id, 'nova', meta)
+ self.client.set_server_metadata_item(self.server['id'], 'nova', meta)
# Verify the meta item's value has been updated
- resp_metadata = (self.client.list_server_metadata(self.server_id)
+ resp_metadata = (self.client.list_server_metadata(self.server['id'])
['metadata'])
expected = {'key1': 'value1', 'key2': 'value2', 'nova': 'alt'}
self.assertEqual(expected, resp_metadata)
@@ -107,10 +106,10 @@
@test.idempotent_id('127642d6-4c7b-4486-b7cd-07265a378658')
def test_delete_server_metadata_item(self):
# The metadata value/key pair should be deleted from the server
- self.client.delete_server_metadata_item(self.server_id, 'key1')
+ self.client.delete_server_metadata_item(self.server['id'], 'key1')
# Verify the metadata item has been removed
- resp_metadata = (self.client.list_server_metadata(self.server_id)
+ resp_metadata = (self.client.list_server_metadata(self.server['id'])
['metadata'])
expected = {'key2': 'value2'}
self.assertEqual(expected, resp_metadata)
diff --git a/tempest/api/compute/servers/test_server_metadata_negative.py b/tempest/api/compute/servers/test_server_metadata_negative.py
index cbe70e2..aae9101 100644
--- a/tempest/api/compute/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/servers/test_server_metadata_negative.py
@@ -31,9 +31,7 @@
def resource_setup(cls):
super(ServerMetadataNegativeTestJSON, cls).resource_setup()
cls.tenant_id = cls.client.tenant_id
- server = cls.create_test_server(metadata={}, wait_until='ACTIVE')
-
- cls.server_id = server['id']
+ cls.server = cls.create_test_server(metadata={}, wait_until='ACTIVE')
@test.attr(type=['negative'])
@test.idempotent_id('fe114a8f-3a57-4eff-9ee2-4e14628df049')
@@ -87,7 +85,7 @@
meta = {'testkey': 'testvalue'}
self.assertRaises(lib_exc.BadRequest,
self.client.set_server_metadata_item,
- self.server_id, 'key', meta)
+ self.server['id'], 'key', meta)
@test.attr(type=['negative'])
@test.idempotent_id('0df38c2a-3d4e-4db5-98d8-d4d9fa843a12')
@@ -118,7 +116,7 @@
meta = {'': 'data1'}
self.assertRaises(lib_exc.BadRequest,
self.client.update_server_metadata,
- self.server_id, meta=meta)
+ self.server['id'], meta=meta)
@test.attr(type=['negative'])
@test.idempotent_id('6bbd88e1-f8b3-424d-ba10-ae21c45ada8d')
@@ -146,14 +144,14 @@
req_metadata['key' + str(num)] = 'val' + str(num)
self.assertRaises((lib_exc.OverLimit, lib_exc.Forbidden),
self.client.set_server_metadata,
- self.server_id, req_metadata)
+ self.server['id'], req_metadata)
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised while exceeding metadata items limit for
# tenant.
self.assertRaises((lib_exc.Forbidden, lib_exc.OverLimit),
self.client.update_server_metadata,
- self.server_id, req_metadata)
+ self.server['id'], req_metadata)
@test.attr(type=['negative'])
@test.idempotent_id('96100343-7fa9-40d8-80fa-d29ef588ce1c')
@@ -163,7 +161,7 @@
meta = {'': 'data1'}
self.assertRaises(lib_exc.BadRequest,
self.client.set_server_metadata,
- self.server_id, meta=meta)
+ self.server['id'], meta=meta)
@test.attr(type=['negative'])
@test.idempotent_id('64a91aee-9723-4863-be44-4c9d9f1e7d0e')
@@ -173,4 +171,4 @@
meta = {'meta1': 'data1'}
self.assertRaises(lib_exc.BadRequest,
self.client.set_server_metadata,
- self.server_id, meta=meta, no_metadata_field=True)
+ self.server['id'], meta=meta, no_metadata_field=True)
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 89be3f3..1b1b339 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -490,6 +490,36 @@
self.client.unshelve_server,
self.server_id)
+ @test.attr(type=['negative'])
+ @test.idempotent_id('74085be3-a370-4ca2-bc51-2d0e10e0f573')
+ @test.services('volume', 'image')
+ def test_create_server_from_non_bootable_volume(self):
+ # Create a volume
+ volume = self.create_volume()
+
+ # Update volume bootable status to false
+ self.volumes_client.set_bootable_volume(volume['id'],
+ bootable=False)
+
+ # Verify bootable flag was updated
+ nonbootable_vol = self.volumes_client.show_volume(
+ volume['id'])['volume']
+ self.assertEqual('false', nonbootable_vol['bootable'])
+
+ # Block device mapping
+ bd_map = [{'boot_index': '0',
+ 'uuid': volume['id'],
+ 'source_type': 'volume',
+ 'destination_type': 'volume',
+ 'delete_on_termination': False}]
+
+ # Try creating a server from non-bootable volume
+ self.assertRaises(lib_exc.BadRequest,
+ self.create_test_server,
+ image_id='',
+ wait_until='ACTIVE',
+ block_device_mapping_v2=bd_map)
+
class ServersNegativeTestMultiTenantJSON(base.BaseV2ComputeTest):
diff --git a/tempest/api/compute/servers/test_virtual_interfaces.py b/tempest/api/compute/servers/test_virtual_interfaces.py
index e620e03..08c34d3 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces.py
@@ -40,8 +40,7 @@
@classmethod
def resource_setup(cls):
super(VirtualInterfacesTestJSON, cls).resource_setup()
- server = cls.create_test_server(wait_until='ACTIVE')
- cls.server_id = server['id']
+ cls.server = cls.create_test_server(wait_until='ACTIVE')
@test.idempotent_id('96c4e2ef-5e4d-4d7f-87f5-fed6dca18016')
@test.services('network')
@@ -53,9 +52,9 @@
# TODO(mriedem): After a microversion implements the API for
# neutron, a 400 should be a failure for nova-network and neutron.
with testtools.ExpectedException(exceptions.BadRequest):
- self.client.list_virtual_interfaces(self.server_id)
+ self.client.list_virtual_interfaces(self.server['id'])
else:
- output = self.client.list_virtual_interfaces(self.server_id)
+ output = self.client.list_virtual_interfaces(self.server['id'])
self.assertIsNotNone(output)
virt_ifaces = output
self.assertNotEqual(0, len(virt_ifaces['virtual_interfaces']),
diff --git a/tempest/api/compute/test_live_block_migration_negative.py b/tempest/api/compute/test_live_block_migration_negative.py
index ffd274f..bd2b185 100644
--- a/tempest/api/compute/test_live_block_migration_negative.py
+++ b/tempest/api/compute/test_live_block_migration_negative.py
@@ -49,9 +49,8 @@
# Migrating to an invalid host should not change the status
target_host = data_utils.rand_name('host')
server = self.create_test_server(wait_until="ACTIVE")
- server_id = server['id']
self.assertRaises(lib_exc.BadRequest, self._migrate_server_to,
- server_id, target_host)
- waiters.wait_for_server_status(self.servers_client, server_id,
+ server['id'], target_host)
+ 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 c48169f..d4831b1 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -17,7 +17,6 @@
from tempest.api.compute import base
from tempest.common import compute
-from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
from tempest.common import waiters
from tempest import config
@@ -72,12 +71,8 @@
def _create_and_attach_volume(self, server):
# Create a volume and wait for it to become ready
- vol_name = data_utils.rand_name(self.__class__.__name__ + '-volume')
- volume = self.volumes_client.create_volume(
- size=CONF.volume.volume_size, display_name=vol_name)['volume']
+ volume = self.create_volume()
self.addCleanup(self.delete_volume, volume['id'])
- waiters.wait_for_volume_status(self.volumes_client,
- volume['id'], 'available')
# Attach the volume to the server
self.attachment = self.servers_client.attach_volume(
diff --git a/tempest/api/compute/volumes/test_volume_snapshots.py b/tempest/api/compute/volumes/test_volume_snapshots.py
index e96982d..460c882 100644
--- a/tempest/api/compute/volumes/test_volume_snapshots.py
+++ b/tempest/api/compute/volumes/test_volume_snapshots.py
@@ -40,13 +40,9 @@
@test.idempotent_id('cd4ec87d-7825-450d-8040-6e2068f2da8f')
def test_volume_snapshot_create_get_list_delete(self):
- v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
- volume = self.volumes_client.create_volume(
- size=CONF.volume.volume_size,
- display_name=v_name)['volume']
+ volume = self.create_volume()
self.addCleanup(self.delete_volume, volume['id'])
- waiters.wait_for_volume_status(self.volumes_client, volume['id'],
- 'available')
+
s_name = data_utils.rand_name(self.__class__.__name__ + '-Snapshot')
# Create snapshot
snapshot = self.snapshots_client.create_snapshot(
diff --git a/tempest/api/identity/v2/test_users.py b/tempest/api/identity/v2/test_users.py
index 4833f9e..33d212c 100644
--- a/tempest/api/identity/v2/test_users.py
+++ b/tempest/api/identity/v2/test_users.py
@@ -44,6 +44,11 @@
# Clear auth restores the original credentials and deletes
# cached auth data
client.auth_provider.clear_auth()
+ # NOTE(lbragstad): Fernet tokens are not subsecond aware and
+ # Keystone should only be precise to the second. Sleep to ensure we
+ # are passing the second boundary before attempting to
+ # authenticate.
+ time.sleep(1)
client.auth_provider.set_auth()
old_pass = self.creds.password
diff --git a/tempest/api/identity/v3/test_users.py b/tempest/api/identity/v3/test_users.py
index c92e750..1a38f3a 100644
--- a/tempest/api/identity/v3/test_users.py
+++ b/tempest/api/identity/v3/test_users.py
@@ -44,6 +44,11 @@
# Clear auth restores the original credentials and deletes
# cached auth data
client.auth_provider.clear_auth()
+ # NOTE(lbragstad): Fernet tokens are not subsecond aware and
+ # Keystone should only be precise to the second. Sleep to ensure we
+ # are passing the second boundary before attempting to
+ # authenticate.
+ time.sleep(1)
client.auth_provider.set_auth()
old_pass = self.creds.password
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 26b88b0..1cc3fa2 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -60,7 +60,7 @@
"""Wrapper that returns a test image."""
if 'name' not in kwargs:
- name = data_utils.rand_name(cls.__name__ + "-instance")
+ name = data_utils.rand_name(cls.__name__ + "-image")
kwargs['name'] = name
params = cls._get_create_params(**kwargs)
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index 269e297..7d52695 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -247,7 +247,7 @@
def test_index_min_size(self):
images_list = self.client.list_images(size_min=142)['images']
for image in images_list:
- self.assertTrue(image['size'] >= 142)
+ self.assertGreaterEqual(image['size'], 142)
result_set = set(map(lambda x: x['id'], images_list))
self.assertTrue(self.size142_set <= result_set)
self.assertFalse(self.size42_set <= result_set)
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index aff8a78..6f8d239 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -157,9 +157,7 @@
"""
size = random.randint(1024, 4096)
image_file = six.BytesIO(data_utils.random_bytes(size))
- name = data_utils.rand_name('image')
- image = cls.create_image(name=name,
- container_format=container_format,
+ image = cls.create_image(container_format=container_format,
disk_format=disk_format,
visibility='private')
cls.client.store_image_file(image['id'], data=image_file)
diff --git a/tempest/api/network/admin/test_floating_ips_admin_actions.py b/tempest/api/network/admin/test_floating_ips_admin_actions.py
index 2686af2..a32e7da 100644
--- a/tempest/api/network/admin/test_floating_ips_admin_actions.py
+++ b/tempest/api/network/admin/test_floating_ips_admin_actions.py
@@ -14,7 +14,6 @@
# under the License.
from tempest.api.network import base
-from tempest.common.utils import data_utils
from tempest import config
from tempest import test
@@ -44,8 +43,7 @@
cls.floating_ip = cls.create_floatingip(cls.ext_net_id)
cls.network = cls.create_network()
cls.subnet = cls.create_subnet(cls.network)
- cls.router = cls.create_router(data_utils.rand_name('router-'),
- external_network_id=cls.ext_net_id)
+ cls.router = cls.create_router(external_network_id=cls.ext_net_id)
cls.create_router_interface(cls.router['id'], cls.subnet['id'])
cls.port = cls.create_port(cls.network)
diff --git a/tempest/api/network/admin/test_l3_agent_scheduler.py b/tempest/api/network/admin/test_l3_agent_scheduler.py
index dca4523..c2ff038 100644
--- a/tempest/api/network/admin/test_l3_agent_scheduler.py
+++ b/tempest/api/network/admin/test_l3_agent_scheduler.py
@@ -13,7 +13,6 @@
# under the License.
from tempest.api.network import base
-from tempest.common.utils import data_utils
from tempest import config
from tempest.lib import exceptions
from tempest import test
@@ -66,7 +65,7 @@
else:
msg = "L3 Agent Scheduler enabled in conf, but L3 Agent not found"
raise exceptions.InvalidConfiguration(msg)
- cls.router = cls.create_router(data_utils.rand_name('router'))
+ cls.router = cls.create_router()
if CONF.network.dvr_extra_resources:
# NOTE(armax): If DVR is an available extension, and the created
diff --git a/tempest/api/network/admin/test_routers_dvr.py b/tempest/api/network/admin/test_routers_dvr.py
index 36cb15f..66feba8 100644
--- a/tempest/api/network/admin/test_routers_dvr.py
+++ b/tempest/api/network/admin/test_routers_dvr.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import testtools
+
from tempest.api.network import base_routers as base
from tempest.common.utils import data_utils
from tempest import test
@@ -80,6 +82,8 @@
self.assertFalse(router['router']['distributed'])
@test.idempotent_id('acd43596-c1fb-439d-ada8-31ad48ae3c2e')
+ @testtools.skipUnless(test.is_extension_enabled('l3-ha', 'network'),
+ 'HA routers are not available.')
def test_centralized_router_update_to_dvr(self):
"""Test centralized router update
@@ -95,9 +99,11 @@
"""
name = data_utils.rand_name('router')
# router needs to be in admin state down in order to be upgraded to DVR
+ # l3ha routers are not upgradable to dvr, make it explicitly non ha
router = self.admin_routers_client.create_router(name=name,
distributed=False,
- admin_state_up=False)
+ admin_state_up=False,
+ ha=False)
self.addCleanup(self.admin_routers_client.delete_router,
router['router']['id'])
self.assertFalse(router['router']['distributed'])
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 5c67d68..629926d 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -26,7 +26,7 @@
class BaseNetworkTest(tempest.test.BaseTestCase):
- """Base class for the Neutron tests
+ """Base class for the Neutron tests.
Per the Neutron API Guide, API v1.x was removed from the source code tree
(docs.openstack.org/api/openstack-network/2.0/content/Overview-d1e71.html)
@@ -137,7 +137,8 @@
@classmethod
def create_network(cls, network_name=None):
"""Wrapper utility that returns a test network."""
- network_name = network_name or data_utils.rand_name('test-network-')
+ network_name = network_name or data_utils.rand_name(
+ cls.__name__ + "-network")
body = cls.networks_client.create_network(name=network_name)
network = body['network']
@@ -148,7 +149,6 @@
def create_subnet(cls, network, gateway='', cidr=None, mask_bits=None,
ip_version=None, client=None, **kwargs):
"""Wrapper utility that returns a test subnet."""
-
# allow tests to use admin client
if not client:
client = cls.subnets_client
@@ -208,6 +208,9 @@
def create_router(cls, router_name=None, admin_state_up=False,
external_network_id=None, enable_snat=None,
**kwargs):
+ router_name = router_name or data_utils.rand_name(
+ cls.__name__ + "-router")
+
ext_gw_info = {}
if external_network_id:
ext_gw_info['network_id'] = external_network_id
diff --git a/tempest/api/network/base_routers.py b/tempest/api/network/base_routers.py
index 807257f..5fb5232 100644
--- a/tempest/api/network/base_routers.py
+++ b/tempest/api/network/base_routers.py
@@ -25,7 +25,7 @@
self.delete_router(router)
self.routers.remove(router)
- def _create_router(self, name, admin_state_up=False,
+ def _create_router(self, name=None, admin_state_up=False,
external_network_id=None, enable_snat=None):
# associate a cleanup with created routers to avoid quota limits
router = self.create_router(name, admin_state_up,
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index 4bc4262..84c48ec 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -348,9 +348,7 @@
def _create_subnet_router(self, kwargs):
subnet = self.create_subnet(self.network, **kwargs)
- router = self.create_router(
- router_name=data_utils.rand_name("routerv6-"),
- admin_state_up=True)
+ router = self.create_router(admin_state_up=True)
port = self.create_router_interface(router['id'],
subnet['id'])
body = self.ports_client.show_port(port['port_id'])
diff --git a/tempest/api/network/test_floating_ips.py b/tempest/api/network/test_floating_ips.py
index c64b01e..efe8982 100644
--- a/tempest/api/network/test_floating_ips.py
+++ b/tempest/api/network/test_floating_ips.py
@@ -14,7 +14,6 @@
# under the License.
from tempest.api.network import base
-from tempest.common.utils import data_utils
from tempest.common.utils import net_utils
from tempest import config
from tempest import test
@@ -55,8 +54,7 @@
# Create network, subnet, router and add interface
cls.network = cls.create_network()
cls.subnet = cls.create_subnet(cls.network, enable_dhcp=False)
- cls.router = cls.create_router(data_utils.rand_name('router-'),
- external_network_id=cls.ext_net_id)
+ cls.router = cls.create_router(external_network_id=cls.ext_net_id)
cls.create_router_interface(cls.router['id'], cls.subnet['id'])
# Create two ports one each for Creation and Updating of floatingIP
for i in range(2):
@@ -156,8 +154,7 @@
self.assertEqual(created_floating_ip['router_id'], self.router['id'])
network2 = self.create_network()
subnet2 = self.create_subnet(network2)
- router2 = self.create_router(data_utils.rand_name('router-'),
- external_network_id=self.ext_net_id)
+ router2 = self.create_router(external_network_id=self.ext_net_id)
self.create_router_interface(router2['id'], subnet2['id'])
port_other_router = self.create_port(network2)
# Associate floating IP to the other port on another router
diff --git a/tempest/api/network/test_floating_ips_negative.py b/tempest/api/network/test_floating_ips_negative.py
index 963d99d..7ffc30f 100644
--- a/tempest/api/network/test_floating_ips_negative.py
+++ b/tempest/api/network/test_floating_ips_negative.py
@@ -15,7 +15,6 @@
# under the License.
from tempest.api.network import base
-from tempest.common.utils import data_utils
from tempest import config
from tempest.lib import exceptions as lib_exc
from tempest import test
@@ -45,7 +44,7 @@
# Create a network with a subnet connected to a router.
cls.network = cls.create_network()
cls.subnet = cls.create_subnet(cls.network)
- cls.router = cls.create_router(data_utils.rand_name('router'))
+ cls.router = cls.create_router()
cls.create_router_interface(cls.router['id'], cls.subnet['id'])
cls.port = cls.create_port(cls.network)
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index 819ef90..6b0c20f 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -175,8 +175,7 @@
@test.idempotent_id('0e269138-0da6-4efc-a46d-578161e7b221')
def test_create_update_delete_network_subnet(self):
# Create a network
- name = data_utils.rand_name('network-')
- network = self.create_network(network_name=name)
+ network = self.create_network()
self.addCleanup(self._delete_network, network)
net_id = network['id']
self.assertEqual('ACTIVE', network['status'])
@@ -277,29 +276,22 @@
@test.idempotent_id('f04f61a9-b7f3-4194-90b2-9bcf660d1bfe')
def test_delete_network_with_subnet(self):
# Creates a network
- name = data_utils.rand_name('network-')
- body = self.networks_client.create_network(name=name)
- network = body['network']
+ network = self.create_network()
net_id = network['id']
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
- self.networks_client.delete_network, net_id)
+ self._delete_network, network)
# Find a cidr that is not in use yet and create a subnet with it
subnet = self.create_subnet(network)
subnet_id = subnet['id']
# Delete network while the subnet still exists
- body = self.networks_client.delete_network(net_id)
+ self.networks_client.delete_network(net_id)
# Verify that the subnet got automatically deleted.
self.assertRaises(lib_exc.NotFound, self.subnets_client.show_subnet,
subnet_id)
- # Since create_subnet adds the subnet to the delete list, and it is
- # actually deleted here - this will create and issue, hence remove
- # it from the list.
- self.subnets.pop()
-
@test.idempotent_id('d2d596e2-8e76-47a9-ac51-d4648009f4d3')
def test_create_delete_subnet_without_gateway(self):
self._create_verify_delete_subnet()
@@ -525,8 +517,7 @@
def test_create_delete_subnet_with_gw(self):
net = netaddr.IPNetwork(CONF.network.project_network_v6_cidr)
gateway = str(netaddr.IPAddress(net.first + 2))
- name = data_utils.rand_name('network-')
- network = self.create_network(network_name=name)
+ network = self.create_network()
subnet = self.create_subnet(network, gateway)
# Verifies Subnet GW in IPv6
self.assertEqual(subnet['gateway_ip'], gateway)
@@ -535,16 +526,14 @@
def test_create_delete_subnet_with_default_gw(self):
net = netaddr.IPNetwork(CONF.network.project_network_v6_cidr)
gateway_ip = str(netaddr.IPAddress(net.first + 1))
- name = data_utils.rand_name('network-')
- network = self.create_network(network_name=name)
+ network = self.create_network()
subnet = self.create_subnet(network)
# Verifies Subnet GW in IPv6
self.assertEqual(subnet['gateway_ip'], gateway_ip)
@test.idempotent_id('a9653883-b2a4-469b-8c3c-4518430a7e55')
def test_create_list_subnet_with_no_gw64_one_network(self):
- name = data_utils.rand_name('network-')
- network = self.create_network(name)
+ network = self.create_network()
ipv6_gateway = self.subnet_dict(['gateway'])['gateway']
subnet1 = self.create_subnet(network,
ip_version=6,
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 12539ba..15d289d 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -72,8 +72,7 @@
@test.idempotent_id('67f1b811-f8db-43e2-86bd-72c074d4a42c')
def test_create_bulk_port(self):
network1 = self.network
- name = data_utils.rand_name('network-')
- network2 = self.create_network(network_name=name)
+ network2 = self.create_network()
network_list = [network1['id'], network2['id']]
port_list = [{'network_id': net_id} for net_id in network_list]
body = self.ports_client.create_bulk_ports(ports=port_list)
@@ -200,7 +199,7 @@
self.addCleanup(self.networks_client.delete_network, network['id'])
subnet = self.create_subnet(network)
self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
- router = self.create_router(data_utils.rand_name('router-'))
+ router = self.create_router()
self.addCleanup(self.routers_client.delete_router, router['id'])
port = self.ports_client.create_port(network_id=network['id'])
# Add router interface to port created above
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 98a4f63..de2e71f 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -106,9 +106,8 @@
@test.requires_ext(extension='ext-gw-mode', service='network')
def test_create_router_with_default_snat_value(self):
# Create a router with default snat rule
- name = data_utils.rand_name('router')
router = self._create_router(
- name, external_network_id=CONF.network.public_network_id)
+ external_network_id=CONF.network.public_network_id)
self._verify_router_gateway(
router['id'], {'network_id': CONF.network.public_network_id,
'enable_snat': True})
@@ -136,7 +135,7 @@
def test_add_remove_router_interface_with_subnet_id(self):
network = self.create_network()
subnet = self.create_subnet(network)
- router = self._create_router(data_utils.rand_name('router-'))
+ router = self._create_router()
# Add router interface with subnet id
interface = self.routers_client.add_router_interface(
router['id'], subnet_id=subnet['id'])
@@ -155,7 +154,7 @@
def test_add_remove_router_interface_with_port_id(self):
network = self.create_network()
self.create_subnet(network)
- router = self._create_router(data_utils.rand_name('router-'))
+ router = self._create_router()
port_body = self.ports_client.create_port(
network_id=network['id'])
# add router interface to port created above
@@ -201,7 +200,7 @@
@test.idempotent_id('6cc285d8-46bf-4f36-9b1a-783e3008ba79')
def test_update_router_set_gateway(self):
- router = self._create_router(data_utils.rand_name('router-'))
+ router = self._create_router()
self.routers_client.update_router(
router['id'],
external_gateway_info={
@@ -215,7 +214,7 @@
@test.idempotent_id('b386c111-3b21-466d-880c-5e72b01e1a33')
@test.requires_ext(extension='ext-gw-mode', service='network')
def test_update_router_set_gateway_with_snat_explicit(self):
- router = self._create_router(data_utils.rand_name('router-'))
+ router = self._create_router()
self.admin_routers_client.update_router(
router['id'],
external_gateway_info={
@@ -230,7 +229,7 @@
@test.idempotent_id('96536bc7-8262-4fb2-9967-5c46940fa279')
@test.requires_ext(extension='ext-gw-mode', service='network')
def test_update_router_set_gateway_without_snat(self):
- router = self._create_router(data_utils.rand_name('router-'))
+ router = self._create_router()
self.admin_routers_client.update_router(
router['id'],
external_gateway_info={
@@ -245,7 +244,6 @@
@test.idempotent_id('ad81b7ee-4f81-407b-a19c-17e623f763e8')
def test_update_router_unset_gateway(self):
router = self._create_router(
- data_utils.rand_name('router-'),
external_network_id=CONF.network.public_network_id)
self.routers_client.update_router(router['id'],
external_gateway_info={})
@@ -260,7 +258,6 @@
@test.requires_ext(extension='ext-gw-mode', service='network')
def test_update_router_reset_gateway_without_snat(self):
router = self._create_router(
- data_utils.rand_name('router-'),
external_network_id=CONF.network.public_network_id)
self.admin_routers_client.update_router(
router['id'],
@@ -283,8 +280,7 @@
test_routes = []
routes_num = 4
# Create a router
- router = self._create_router(
- data_utils.rand_name('router-'), True)
+ router = self._create_router(admin_state_up=True)
self.addCleanup(
self._delete_extra_routes,
router['id'])
@@ -338,7 +334,7 @@
@test.idempotent_id('a8902683-c788-4246-95c7-ad9c6d63a4d9')
def test_update_router_admin_state(self):
- router = self._create_router(data_utils.rand_name('router-'))
+ router = self._create_router()
self.assertFalse(router['admin_state_up'])
# Update router admin state
update_body = self.routers_client.update_router(router['id'],
@@ -357,7 +353,7 @@
subnet01 = self.create_subnet(network01)
sub02_cidr = netaddr.IPNetwork(self.tenant_cidr).next()
subnet02 = self.create_subnet(network02, cidr=sub02_cidr)
- router = self._create_router(data_utils.rand_name('router-'))
+ router = self._create_router()
interface01 = self._add_router_interface_with_subnet_id(router['id'],
subnet01['id'])
self._verify_router_interface(router['id'], subnet01['id'],
@@ -371,7 +367,7 @@
def test_router_interface_port_update_with_fixed_ip(self):
network = self.create_network()
subnet = self.create_subnet(network)
- router = self._create_router(data_utils.rand_name('router-'))
+ router = self._create_router()
fixed_ip = [{'subnet_id': subnet['id']}]
interface = self._add_router_interface_with_subnet_id(router['id'],
subnet['id'])
@@ -417,7 +413,7 @@
@test.idempotent_id('644d7a4a-01a1-4b68-bb8d-0c0042cb1729')
def test_convert_centralized_router(self):
- router = self._create_router(data_utils.rand_name('router'))
+ router = self._create_router()
self.assertNotIn('distributed', router)
update_body = self.admin_routers_client.update_router(router['id'],
distributed=True)
diff --git a/tempest/api/network/test_routers_negative.py b/tempest/api/network/test_routers_negative.py
index cd9f6ad..b3983de 100644
--- a/tempest/api/network/test_routers_negative.py
+++ b/tempest/api/network/test_routers_negative.py
@@ -36,7 +36,7 @@
@classmethod
def resource_setup(cls):
super(RoutersNegativeTest, cls).resource_setup()
- cls.router = cls.create_router(data_utils.rand_name('router-'))
+ cls.router = cls.create_router()
cls.network = cls.create_network()
cls.subnet = cls.create_subnet(cls.network)
cls.tenant_cidr = (CONF.network.project_network_cidr
@@ -55,8 +55,7 @@
@test.attr(type=['negative'])
@test.idempotent_id('11836a18-0b15-4327-a50b-f0d9dc66bddd')
def test_router_add_gateway_net_not_external_returns_400(self):
- alt_network = self.create_network(
- network_name=data_utils.rand_name('router-negative-'))
+ alt_network = self.create_network()
sub_cidr = netaddr.IPNetwork(self.tenant_cidr).next()
self.create_subnet(alt_network, cidr=sub_cidr)
self.assertRaises(lib_exc.BadRequest,
@@ -128,14 +127,12 @@
@classmethod
def resource_setup(cls):
super(DvrRoutersNegativeTest, cls).resource_setup()
- cls.router = cls.create_router(data_utils.rand_name('router'))
+ cls.router = cls.create_router()
cls.network = cls.create_network()
cls.subnet = cls.create_subnet(cls.network)
@test.attr(type=['negative'])
@test.idempotent_id('4990b055-8fc7-48ab-bba7-aa28beaad0b9')
def test_router_create_tenant_distributed_returns_forbidden(self):
- self.assertRaises(lib_exc.Forbidden,
- self.create_router,
- data_utils.rand_name('router'),
+ self.assertRaises(lib_exc.Forbidden, self.create_router,
distributed=True)
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index fd973c6..1b1ffd1 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -114,7 +114,9 @@
object_client = cls.object_client
for cont in cls.containers:
try:
- objlist = container_client.list_all_container_objects(cont)
+ params = {'limit': 9999, 'format': 'json'}
+ resp, objlist = container_client.list_container_contents(
+ cont, params)
# delete every object in the container
for obj in objlist:
test_utils.call_and_ignore_notfound_exc(
diff --git a/tempest/api/object_storage/test_container_services_negative.py b/tempest/api/object_storage/test_container_services_negative.py
index ed99eb2..7049db0 100644
--- a/tempest/api/object_storage/test_container_services_negative.py
+++ b/tempest/api/object_storage/test_container_services_negative.py
@@ -129,10 +129,10 @@
# that doesn't exist.
nonexistent_name = data_utils.rand_name(
name="TestNonexistentContainer")
-
+ params = {'limit': 9999, 'format': 'json'}
self.assertRaises(exceptions.NotFound,
- self.container_client.list_all_container_objects,
- nonexistent_name)
+ self.container_client.list_container_contents,
+ nonexistent_name, params)
@test.attr(type=["negative"])
@test.idempotent_id('86b2ab08-92d5-493d-acd2-85f0c848819e')
@@ -143,10 +143,10 @@
# delete container
resp, _ = self.container_client.delete_container(container_name)
self.assertHeaders(resp, 'Container', 'DELETE')
-
+ params = {'limit': 9999, 'format': 'json'}
self.assertRaises(exceptions.NotFound,
- self.container_client.list_all_container_objects,
- container_name)
+ self.container_client.list_container_contents,
+ container_name, params)
@test.attr(type=["negative"])
@test.idempotent_id('42da116e-1e8c-4c96-9e06-2f13884ed2b1')
diff --git a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
index 8d12e75..160bf6f 100644
--- a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
+++ b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
@@ -78,10 +78,10 @@
self.assertIn('-----BEGIN', output_map['KeyPair_PrivateKey'])
# Test that second key generated public key, and private key is not
# in the output due to save_private_key = false
- self.assertTrue('KeyPairDontSavePrivate_PublicKey' in output_map)
- self.assertTrue('Generated' in
- output_map['KeyPairDontSavePrivate_PublicKey'])
- self.assertTrue(u'KeyPairDontSavePrivate_PrivateKey' in output_map)
+ self.assertIn('KeyPairDontSavePrivate_PublicKey', output_map)
+ self.assertIn('Generated',
+ output_map['KeyPairDontSavePrivate_PublicKey'])
+ self.assertIn(u'KeyPairDontSavePrivate_PrivateKey', output_map)
private_key = output_map['KeyPairDontSavePrivate_PrivateKey']
self.assertTrue(len(private_key) == 0)
diff --git a/tempest/api/orchestration/stacks/test_templates_negative.py b/tempest/api/orchestration/stacks/test_templates_negative.py
index 24e10dd..f8245c1 100644
--- a/tempest/api/orchestration/stacks/test_templates_negative.py
+++ b/tempest/api/orchestration/stacks/test_templates_negative.py
@@ -27,7 +27,7 @@
Type: AWS::IAM::User
"""
- invalid_template_url = 'http://www.example.com/template.yaml'
+ invalid_template_url = 'http:///template.yaml'
@classmethod
def resource_setup(cls):
@@ -57,4 +57,4 @@
}
"""
- invalid_template_url = 'http://www.example.com/template.template'
+ invalid_template_url = 'http:///template.template'
diff --git a/tempest/api/volume/admin/test_snapshots_actions.py b/tempest/api/volume/admin/test_snapshots_actions.py
index 1468e90..5af83b3 100644
--- a/tempest/api/volume/admin/test_snapshots_actions.py
+++ b/tempest/api/volume/admin/test_snapshots_actions.py
@@ -14,7 +14,6 @@
# under the License.
from tempest.api.volume import base
-from tempest.common.utils import data_utils
from tempest import config
from tempest import test
@@ -38,16 +37,10 @@
super(SnapshotsActionsV2Test, cls).resource_setup()
# Create a test shared volume for tests
- vol_name = data_utils.rand_name(cls.__name__ + '-Volume')
- cls.name_field = cls.special_fields['name_field']
- params = {cls.name_field: vol_name}
- cls.volume = cls.create_volume(**params)
+ cls.volume = cls.create_volume()
# Create a test shared snapshot for tests
- snap_name = data_utils.rand_name(cls.__name__ + '-Snapshot')
- params = {cls.name_field: snap_name}
- cls.snapshot = cls.create_snapshot(
- volume_id=cls.volume['id'], **params)
+ cls.snapshot = cls.create_snapshot(volume_id=cls.volume['id'])
def tearDown(self):
# Set snapshot's status to available after test
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index e6b8234..b9aeb99 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -113,13 +113,12 @@
if 'size' not in kwargs:
kwargs['size'] = CONF.volume.volume_size
- name = data_utils.rand_name(cls.__name__ + '-Volume')
-
name_field = cls.special_fields['name_field']
+ if name_field not in kwargs:
+ name = data_utils.rand_name(cls.__name__ + '-Volume')
+ kwargs[name_field] = name
- kwargs[name_field] = name
volume = cls.volumes_client.create_volume(**kwargs)['volume']
-
cls.volumes.append(volume)
waiters.wait_for_volume_status(cls.volumes_client,
volume['id'], 'available')
@@ -128,6 +127,11 @@
@classmethod
def create_snapshot(cls, volume_id=1, **kwargs):
"""Wrapper utility that returns a test snapshot."""
+ name_field = cls.special_fields['name_field']
+ if name_field not in kwargs:
+ name = data_utils.rand_name(cls.__name__ + '-Snapshot')
+ kwargs[name_field] = name
+
snapshot = cls.snapshots_client.create_snapshot(
volume_id=volume_id, **kwargs)['snapshot']
cls.snapshots.append(snapshot)
@@ -172,7 +176,11 @@
except Exception:
pass
- def create_server(self, name, **kwargs):
+ def create_server(self, **kwargs):
+ name = kwargs.pop(
+ 'name',
+ data_utils.rand_name(self.__class__.__name__ + '-instance'))
+
tenant_network = self.get_tenant_network()
body, _ = compute.create_test_server(
self.os,
diff --git a/tempest/api/volume/test_availability_zone.py b/tempest/api/volume/test_availability_zone.py
index fe51375..ae4b8f9 100644
--- a/tempest/api/volume/test_availability_zone.py
+++ b/tempest/api/volume/test_availability_zone.py
@@ -30,7 +30,7 @@
# List of availability zone
availability_zone = (self.client.list_availability_zones()
['availabilityZoneInfo'])
- self.assertTrue(len(availability_zone) > 0)
+ self.assertGreater(len(availability_zone), 0)
class AvailabilityZoneV1TestJSON(AvailabilityZoneV2TestJSON):
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 83844e3..737ce5e 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -50,15 +50,11 @@
cls.volume = cls.create_volume()
@test.idempotent_id('fff42874-7db5-4487-a8e1-ddda5fb5288d')
- @test.stresstest(class_setup_per='process')
@test.attr(type='smoke')
@test.services('compute')
def test_attach_detach_volume_to_instance(self):
# Create a server
- srv_name = data_utils.rand_name(self.__class__.__name__ + '-Instance')
- server = self.create_server(
- name=srv_name,
- wait_until='ACTIVE')
+ server = self.create_server(wait_until='ACTIVE')
# Volume is attached and detached successfully from an instance
self.client.attach_volume(self.volume['id'],
instance_uuid=server['id'],
@@ -85,14 +81,10 @@
self.assertEqual(bool_bootable, bool_flag)
@test.idempotent_id('9516a2c8-9135-488c-8dd6-5677a7e5f371')
- @test.stresstest(class_setup_per='process')
@test.services('compute')
def test_get_volume_attachment(self):
# Create a server
- srv_name = data_utils.rand_name(self.__class__.__name__ + '-Instance')
- server = self.create_server(
- name=srv_name,
- wait_until='ACTIVE')
+ server = self.create_server(wait_until='ACTIVE')
# Verify that a volume's attachment information is retrieved
self.client.attach_volume(self.volume['id'],
instance_uuid=server['id'],
diff --git a/tempest/api/volume/test_volumes_backup.py b/tempest/api/volume/test_volumes_backup.py
index 867e520..141336f 100644
--- a/tempest/api/volume/test_volumes_backup.py
+++ b/tempest/api/volume/test_volumes_backup.py
@@ -84,9 +84,7 @@
volume = self.create_volume()
self.addCleanup(self.volumes_client.delete_volume,
volume['id'])
- server_name = data_utils.rand_name(
- self.__class__.__name__ + '-instance')
- server = self.create_server(name=server_name, wait_until='ACTIVE')
+ server = self.create_server(wait_until='ACTIVE')
# Attach volume to instance
self.servers_client.attach_volume(server['id'],
volumeId=volume['id'])
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index b5ef7c0..40793ec 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -32,6 +32,11 @@
VOLUME_FIELDS = ('id', 'name')
def assertVolumesIn(self, fetched_list, expected_list, fields=None):
+ """Check out the list.
+
+ This function is aim at check out whether all of the volumes in
+ expected_list are in fetched_list.
+ """
if fields:
fieldsgetter = operator.itemgetter(*fields)
expected_list = map(fieldsgetter, expected_list)
@@ -58,7 +63,6 @@
def resource_setup(cls):
super(VolumesV2ListTestJSON, cls).resource_setup()
cls.name = cls.VOLUME_FIELDS[1]
-
# Create 3 test volumes
cls.volume_list = []
cls.metadata = {'Type': 'work'}
@@ -146,6 +150,28 @@
self.assertEqual('available', volume['status'])
self.assertVolumesIn(fetched_list, self.volume_list)
+ @test.idempotent_id('2016a942-3020-40d7-95ce-7613bf8407ce')
+ def test_volumes_list_by_bootable(self):
+ """Check out volumes.
+
+ This test function is aim at check out whether all of the volumes
+ in volume_list are not a bootable volume.
+ """
+ params = {'bootable': 'false'}
+ fetched_list = self.client.list_volumes(params=params)['volumes']
+ self._list_by_param_value_and_assert(params)
+ self.assertVolumesIn(fetched_list, self.volume_list,
+ fields=self.VOLUME_FIELDS)
+
+ @test.idempotent_id('2016a939-72ec-482a-bf49-d5ca06216b9f')
+ def test_volumes_list_details_by_bootable(self):
+ params = {'bootable': 'false'}
+ fetched_list = self.client.list_volumes(
+ detail=True, params=params)['volumes']
+ for volume in fetched_list:
+ self.assertEqual('false', volume['bootable'])
+ self.assertVolumesIn(fetched_list, self.volume_list)
+
@test.idempotent_id('c0cfa863-3020-40d7-b587-e35f597d5d87')
def test_volumes_list_by_availability_zone(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index e8ead5b..fda0dda 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -176,10 +176,7 @@
@test.idempotent_id('f5e56b0a-5d02-43c1-a2a7-c9b792c2e3f6')
@test.services('compute')
def test_attach_volumes_with_nonexistent_volume_id(self):
- srv_name = data_utils.rand_name(self.__class__.__name__ + '-Instance')
- server = self.create_server(
- name=srv_name,
- wait_until='ACTIVE')
+ server = self.create_server(wait_until='ACTIVE')
self.assertRaises(lib_exc.NotFound,
self.client.attach_volume,
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index f971eca..3c05d3e 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -45,11 +45,7 @@
def test_snapshot_create_with_volume_in_use(self):
# Create a snapshot when volume status is in-use
# Create a test instance
- server_name = data_utils.rand_name(
- self.__class__.__name__ + '-instance')
- server = self.create_server(
- name=server_name,
- wait_until='ACTIVE')
+ server = self.create_server(wait_until='ACTIVE')
self.servers_client.attach_volume(
server['id'], volumeId=self.volume_origin['id'],
device='/dev/%s' % CONF.compute.volume_device_name)
@@ -68,9 +64,7 @@
@test.idempotent_id('2a8abbe4-d871-46db-b049-c41f5af8216e')
def test_snapshot_create_get_list_update_delete(self):
# Create a snapshot
- s_name = data_utils.rand_name(self.__class__.__name__ + '-snap')
- params = {self.name_field: s_name}
- snapshot = self.create_snapshot(self.volume_origin['id'], **params)
+ snapshot = self.create_snapshot(self.volume_origin['id'])
# Get the snap and check for some of its details
snap_get = self.snapshots_client.show_snapshot(
diff --git a/tempest/clients.py b/tempest/clients.py
index be6bc02..0158efd 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -19,7 +19,6 @@
from tempest.common import negative_rest_client
from tempest import config
-from tempest import exceptions
from tempest.lib import auth
from tempest.lib import exceptions as lib_exc
from tempest.lib.services import clients
@@ -280,52 +279,33 @@
# Mandatory parameters (always defined)
params = self.parameters['volume']
- self.volume_qos_client = volume.v1.QosSpecsClient(self.auth_provider,
- **params)
- self.volume_qos_v2_client = volume.v2.QosSpecsClient(
- self.auth_provider, **params)
- self.volume_services_client = volume.v1.ServicesClient(
- self.auth_provider, **params)
- self.volume_services_v2_client = volume.v2.ServicesClient(
- self.auth_provider, **params)
- self.backups_client = volume.v1.BackupsClient(self.auth_provider,
- **params)
- self.backups_v2_client = volume.v2.BackupsClient(self.auth_provider,
- **params)
- self.encryption_types_client = volume.v1.EncryptionTypesClient(
- self.auth_provider, **params)
- self.encryption_types_v2_client = volume.v2.EncryptionTypesClient(
- self.auth_provider, **params)
- self.snapshots_client = volume.v1.SnapshotsClient(self.auth_provider,
- **params)
- self.snapshots_v2_client = volume.v2.SnapshotsClient(
- self.auth_provider, **params)
- self.volumes_client = volume.v1.VolumesClient(self.auth_provider,
- **params)
- self.volumes_v2_client = volume.v2.VolumesClient(self.auth_provider,
- **params)
+ self.volume_qos_client = self.volume_v1.QosSpecsClient()
+ self.volume_qos_v2_client = self.volume_v2.QosSpecsClient()
+ self.volume_services_client = self.volume_v1.ServicesClient()
+ self.volume_services_v2_client = self.volume_v2.ServicesClient()
+ self.backups_client = self.volume_v1.BackupsClient()
+ self.backups_v2_client = self.volume_v2.BackupsClient()
+ self.encryption_types_client = self.volume_v1.EncryptionTypesClient()
+ self.encryption_types_v2_client = \
+ self.volume_v2.EncryptionTypesClient()
+ self.snapshots_client = self.volume_v1.SnapshotsClient()
+ self.snapshots_v2_client = self.volume_v2.SnapshotsClient()
+ self.volumes_client = self.volume_v1.VolumesClient()
+ self.volumes_v2_client = self.volume_v2.VolumesClient()
self.volume_messages_client = volume.v3.MessagesClient(
self.auth_provider, **params)
- self.volume_types_client = volume.v1.TypesClient(self.auth_provider,
- **params)
- self.volume_types_v2_client = volume.v2.TypesClient(self.auth_provider,
- **params)
- self.volume_hosts_client = volume.v1.HostsClient(self.auth_provider,
- **params)
- self.volume_hosts_v2_client = volume.v2.HostsClient(self.auth_provider,
- **params)
- self.volume_quotas_client = volume.v1.QuotasClient(self.auth_provider,
- **params)
- self.volume_quotas_v2_client = volume.v2.QuotasClient(
- self.auth_provider, **params)
- self.volumes_extension_client = volume.v1.ExtensionsClient(
- self.auth_provider, **params)
- self.volumes_v2_extension_client = volume.v2.ExtensionsClient(
- self.auth_provider, **params)
+ self.volume_types_client = self.volume_v1.TypesClient()
+ self.volume_types_v2_client = self.volume_v2.TypesClient()
+ self.volume_hosts_client = self.volume_v1.HostsClient()
+ self.volume_hosts_v2_client = self.volume_v2.HostsClient()
+ self.volume_quotas_client = self.volume_v1.QuotasClient()
+ self.volume_quotas_v2_client = self.volume_v2.QuotasClient()
+ self.volumes_extension_client = self.volume_v1.ExtensionsClient()
+ self.volumes_v2_extension_client = self.volume_v2.ExtensionsClient()
self.volume_availability_zone_client = \
- volume.v1.AvailabilityZoneClient(self.auth_provider, **params)
+ self.volume_v1.AvailabilityZoneClient()
self.volume_v2_availability_zone_client = \
- volume.v2.AvailabilityZoneClient(self.auth_provider, **params)
+ self.volume_v2.AvailabilityZoneClient()
def _set_object_storage_clients(self):
# Mandatory parameters (always defined)
@@ -350,7 +330,7 @@
# kwargs for auth provider match the common ones used by service clients
default_params = config.service_client_config()
if credentials is None:
- raise exceptions.InvalidCredentials(
+ raise lib_exc.InvalidCredentials(
'Credentials must be specified')
auth_provider_class, auth_url = get_auth_provider_class(
credentials)
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index 1779252..3d38e25 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -22,7 +22,7 @@
credentials for created users, so each user will be in separate tenant and
have the username, tenant_name, password and roles.
-**Usage:** ``tempest-account-generator [-h] [OPTIONS] accounts_file.yaml``.
+**Usage:** ``tempest account-generator [-h] [OPTIONS] accounts_file.yaml``.
Positional Arguments
--------------------
@@ -90,7 +90,7 @@
**-i VERSION**, **--identity-version VERSION** (Optional) Provisions accounts
using the specified version of the identity API. (default: '3').
-To see help on specific argument, please do: ``tempest-account-generator
+To see help on specific argument, please do: ``tempest account-generator
[OPTIONS] <accounts_file.yaml> -h``.
"""
import argparse
@@ -262,9 +262,9 @@
def get_options():
- usage_string = ('tempest-account-generator [-h] <ARG> ...\n\n'
+ usage_string = ('tempest account-generator [-h] <ARG> ...\n\n'
'To see help on specific argument, do:\n'
- 'tempest-account-generator <ARG> -h')
+ 'tempest account-generator <ARG> -h')
parser = argparse.ArgumentParser(
description=DESCRIPTION,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
diff --git a/tempest/cmd/run_stress.py b/tempest/cmd/run_stress.py
deleted file mode 100755
index 7502c23..0000000
--- a/tempest/cmd/run_stress.py
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2013 Quanta Research Cambridge, Inc.
-#
-# 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 argparse
-import inspect
-import sys
-try:
- from unittest import loader
-except ImportError:
- # unittest in python 2.6 does not contain loader, so uses unittest2
- from unittest2 import loader
-import traceback
-import warnings
-
-from cliff import command
-from oslo_log import log as logging
-from oslo_serialization import jsonutils as json
-from testtools import testsuite
-
-from tempest.stress import driver
-
-LOG = logging.getLogger(__name__)
-
-
-def discover_stress_tests(path="./", filter_attr=None, call_inherited=False):
- """Discovers all tempest tests and create action out of them"""
- LOG.info("Start test discovery")
- tests = []
- testloader = loader.TestLoader()
- list = testloader.discover(path)
- for func in (testsuite.iterate_tests(list)):
- attrs = []
- try:
- method_name = getattr(func, '_testMethodName')
- full_name = "%s.%s.%s" % (func.__module__,
- func.__class__.__name__,
- method_name)
- test_func = getattr(func, method_name)
- # NOTE(mkoderer): this contains a list of all type attributes
- attrs = getattr(test_func, "__testtools_attrs")
- except Exception:
- next
- if 'stress' in attrs:
- if filter_attr is not None and filter_attr not in attrs:
- continue
- class_setup_per = getattr(test_func, "st_class_setup_per")
-
- action = {'action':
- "tempest.stress.actions.unit_test.UnitTest",
- 'kwargs': {"test_method": full_name,
- "class_setup_per": class_setup_per
- }
- }
- if (not call_inherited and
- getattr(test_func, "st_allow_inheritance") is not True):
- class_structure = inspect.getmro(test_func.im_class)
- if test_func.__name__ not in class_structure[0].__dict__:
- continue
- tests.append(action)
- return tests
-
-
-class TempestRunStress(command.Command):
-
- @staticmethod
- def display_deprecation_warning():
- warnings.simplefilter('once', category=DeprecationWarning)
- warnings.warn(
- 'Stress tests are deprecated and will be removed from Tempest '
- 'in the Newton release.',
- DeprecationWarning)
- warnings.resetwarnings()
-
- def get_parser(self, prog_name):
- self.display_deprecation_warning()
- pa = super(TempestRunStress, self).get_parser(prog_name)
- pa = add_arguments(pa)
- return pa
-
- def take_action(self, pa):
- try:
- action(pa)
- except Exception:
- LOG.exception("Failure in the stress test framework")
- traceback.print_exc()
- raise
-
- def get_description(self):
- return 'Run tempest stress tests'
-
-
-def add_arguments(parser):
- parser.add_argument('-d', '--duration', default=300, type=int,
- help="Duration of test in secs")
- parser.add_argument('-s', '--serial', action='store_true',
- help="Trigger running tests serially")
- parser.add_argument('-S', '--stop', action='store_true',
- default=False, help="Stop on first error")
- parser.add_argument('-n', '--number', type=int,
- help="How often an action is executed for each "
- "process")
- group = parser.add_mutually_exclusive_group(required=True)
- group.add_argument('-a', '--all', action='store_true',
- help="Execute all stress tests")
- parser.add_argument('-T', '--type',
- help="Filters tests of a certain type (e.g. gate)")
- parser.add_argument('-i', '--call-inherited', action='store_true',
- default=False,
- help="Call also inherited function with stress "
- "attribute")
- group.add_argument('-t', "--tests", nargs='?',
- help="Name of the file with test description")
- return parser
-
-
-def action(ns):
- result = 0
- if not ns.all:
- tests = json.load(open(ns.tests, 'r'))
- else:
- tests = discover_stress_tests(filter_attr=ns.type,
- call_inherited=ns.call_inherited)
-
- if ns.serial:
- # Duration is total time
- duration = ns.duration / len(tests)
- for test in tests:
- step_result = driver.stress_openstack([test],
- duration,
- ns.number,
- ns.stop)
- # NOTE(mkoderer): we just save the last result code
- if (step_result != 0):
- result = step_result
- if ns.stop:
- return result
- else:
- result = driver.stress_openstack(tests,
- ns.duration,
- ns.number,
- ns.stop)
- return result
-
-
-def main():
- TempestRunStress.display_deprecation_warning()
- parser = argparse.ArgumentParser(description='Run stress tests')
- pa = add_arguments(parser)
- ns = pa.parse_args()
- return action(ns)
-
-
-if __name__ == "__main__":
- try:
- sys.exit(main())
- except Exception:
- LOG.exception("Failure in the stress test framework")
- traceback.print_exc()
- sys.exit(1)
diff --git a/tempest/common/utils/net_utils.py b/tempest/common/utils/net_utils.py
index f0d3da3..867b3dd 100644
--- a/tempest/common/utils/net_utils.py
+++ b/tempest/common/utils/net_utils.py
@@ -51,3 +51,23 @@
return addrs
msg = "Insufficient IP addresses available"
raise lib_exc.BadRequest(message=msg)
+
+
+def get_ping_payload_size(mtu, ip_version):
+ """Return the maximum size of ping payload that will fit into MTU."""
+ if not mtu:
+ return None
+ if ip_version == 4:
+ ip_header = 20
+ icmp_header = 8
+ else:
+ ip_header = 40
+ icmp_header = 4
+ res = mtu - ip_header - icmp_header
+ if res < 0:
+ raise lib_exc.BadRequest(
+ message='MTU = %(mtu)d is too low for IPv%(ip_version)d' % {
+ 'mtu': mtu,
+ 'ip_version': ip_version,
+ })
+ return res
diff --git a/tempest/config.py b/tempest/config.py
index 8ce38f9..bc9215c 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -900,44 +900,6 @@
]
-stress_group = cfg.OptGroup(name='stress', title='Stress Test Options')
-
-StressGroup = [
- cfg.StrOpt('nova_logdir',
- help='Directory containing log files on the compute nodes'),
- cfg.IntOpt('max_instances',
- default=16,
- help='Maximum number of instances to create during test.'),
- cfg.StrOpt('controller',
- help='Controller host.'),
- # new stress options
- cfg.StrOpt('target_controller',
- help='Controller host.'),
- cfg.StrOpt('target_ssh_user',
- help='ssh user.'),
- cfg.StrOpt('target_private_key_path',
- help='Path to private key.'),
- cfg.StrOpt('target_logfiles',
- help='regexp for list of log files.'),
- cfg.IntOpt('log_check_interval',
- default=60,
- help='time (in seconds) between log file error checks.'),
- cfg.IntOpt('default_thread_number_per_action',
- default=4,
- help='The number of threads created while stress test.'),
- cfg.BoolOpt('leave_dirty_stack',
- default=False,
- help='Prevent the cleaning (tearDownClass()) between'
- ' each stress test run if an exception occurs'
- ' during this run.'),
- cfg.BoolOpt('full_clean_stack',
- default=False,
- help='Allows a full cleaning process after a stress test.'
- ' Caution : this cleanup will remove every objects of'
- ' every project.')
-]
-
-
scenario_group = cfg.OptGroup(name='scenario', title='Scenario Test Options')
ScenarioGroup = [
@@ -1145,7 +1107,6 @@
(object_storage_group, ObjectStoreGroup),
(object_storage_feature_group, ObjectStoreFeaturesGroup),
(orchestration_group, OrchestrationGroup),
- (stress_group, StressGroup),
(scenario_group, ScenarioGroup),
(service_available_group, ServiceAvailableGroup),
(debug_group, DebugGroup),
@@ -1210,7 +1171,6 @@
self.object_storage_feature_enabled = _CONF[
'object-storage-feature-enabled']
self.orchestration = _CONF.orchestration
- self.stress = _CONF.stress
self.scenario = _CONF.scenario
self.service_available = _CONF.service_available
self.debug = _CONF.debug
diff --git a/tempest/lib/api_schema/response/compute/v2_1/images.py b/tempest/lib/api_schema/response/compute/v2_1/images.py
index b0f1934..f65b9d8 100644
--- a/tempest/lib/api_schema/response/compute/v2_1/images.py
+++ b/tempest/lib/api_schema/response/compute/v2_1/images.py
@@ -19,11 +19,13 @@
image_links = copy.deepcopy(parameter_types.links)
image_links['items']['properties'].update({'type': {'type': 'string'}})
+image_status_enums = ['ACTIVE', 'SAVING', 'DELETED', 'ERROR', 'UNKNOWN']
+
common_image_schema = {
'type': 'object',
'properties': {
'id': {'type': 'string'},
- 'status': {'type': 'string'},
+ 'status': {'enum': image_status_enums},
'updated': {'type': 'string'},
'links': image_links,
'name': {'type': ['string', 'null']},
diff --git a/tempest/lib/common/rest_client.py b/tempest/lib/common/rest_client.py
index 8507f8a..2d2771f 100644
--- a/tempest/lib/common/rest_client.py
+++ b/tempest/lib/common/rest_client.py
@@ -661,8 +661,7 @@
time.sleep(delay)
resp, resp_body = self._request(method, url,
headers=headers, body=body)
- self._error_checker(method, url, headers, body,
- resp, resp_body)
+ self._error_checker(resp, resp_body)
return resp, resp_body
def _get_retry_after_delay(self, resp):
@@ -710,8 +709,7 @@
raise ValueError("Failed to parse date %s" % val)
return time.mktime(parts)
- def _error_checker(self, method, url,
- headers, body, resp, resp_body):
+ def _error_checker(self, resp, resp_body):
# NOTE(mtreinish): Check for httplib response from glance_http. The
# object can't be used here because importing httplib breaks httplib2.
diff --git a/tempest/lib/services/clients.py b/tempest/lib/services/clients.py
index adf666b..2e5c457 100644
--- a/tempest/lib/services/clients.py
+++ b/tempest/lib/services/clients.py
@@ -25,6 +25,7 @@
from tempest.lib.services import compute
from tempest.lib.services import image
from tempest.lib.services import network
+from tempest.lib.services import volume
LOG = logging.getLogger(__name__)
@@ -40,7 +41,9 @@
'compute': compute,
'image.v1': image.v1,
'image.v2': image.v2,
- 'network': network
+ 'network': network,
+ 'volume.v1': volume.v1,
+ 'volume.v2': volume.v2
}
@@ -49,8 +52,7 @@
# NOTE(andreaf) This list will exists only as long the remain clients
# are migrated to tempest.lib, and it will then be deleted without
# deprecation or advance notice
- return set(['identity.v2', 'identity.v3', 'object-storage', 'volume.v1',
- 'volume.v2', 'volume.v3'])
+ return set(['identity.v2', 'identity.v3', 'object-storage', 'volume.v3'])
def available_modules():
diff --git a/tempest/lib/services/compute/versions_client.py b/tempest/lib/services/compute/versions_client.py
index eb4e7e9..b2052c3 100644
--- a/tempest/lib/services/compute/versions_client.py
+++ b/tempest/lib/services/compute/versions_client.py
@@ -40,6 +40,7 @@
def list_versions(self):
version_url = self._get_base_version_url()
resp, body = self.raw_request(version_url, 'GET')
+ self._error_checker(resp, body)
body = json.loads(body)
self.validate_response(schema.list_versions, resp, body)
return rest_client.ResponseBody(resp, body)
@@ -56,6 +57,7 @@
# we need a token for this request
resp, body = self.raw_request(version_url, 'GET',
{'X-Auth-Token': self.token})
+ self._error_checker(resp, body)
body = json.loads(body)
self.validate_response(schema.get_one_version, resp, body)
return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/image/v1/images_client.py b/tempest/lib/services/image/v1/images_client.py
index 9737be3..e67a547 100644
--- a/tempest/lib/services/image/v1/images_client.py
+++ b/tempest/lib/services/image/v1/images_client.py
@@ -34,8 +34,7 @@
data = iter(functools.partial(data.read, CHUNKSIZE), b'')
resp, body = self.request('POST', 'images',
headers=headers, body=data, chunked=True)
- self._error_checker('POST', 'images', headers, data, resp,
- body)
+ self._error_checker(resp, body)
body = json.loads(body)
return rest_client.ResponseBody(resp, body)
@@ -47,8 +46,7 @@
url = 'images/%s' % image_id
resp, body = self.request('PUT', url, headers=headers,
body=data, chunked=True)
- self._error_checker('PUT', url, headers, data,
- resp, body)
+ self._error_checker(resp, body)
body = json.loads(body)
return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/image/v2/namespaces_client.py b/tempest/lib/services/image/v2/namespaces_client.py
index 359ff1d..b00de89 100644
--- a/tempest/lib/services/image/v2/namespaces_client.py
+++ b/tempest/lib/services/image/v2/namespaces_client.py
@@ -37,8 +37,9 @@
def list_namespaces(self):
"""List namespaces
- Available params: see http://developer.openstack.org/
- api-ref/image/v2/metadefs-index.html#list-namespaces
+ For a full list of available parameters, please refer to the official
+ API reference:
+ http://developer.openstack.org/api-ref/image/v2/metadefs-index.html#list-namespaces
"""
url = 'metadefs/namespaces'
resp, body = self.get(url)
diff --git a/tempest/lib/services/network/versions_client.py b/tempest/lib/services/network/versions_client.py
index 0202927..a9c3bbf 100644
--- a/tempest/lib/services/network/versions_client.py
+++ b/tempest/lib/services/network/versions_client.py
@@ -35,6 +35,7 @@
start = time.time()
self._log_request_start('GET', version_url)
response, body = self.raw_request(version_url, 'GET')
+ self._error_checker(response, body)
end = time.time()
self._log_request('GET', version_url, response,
secs=(end - start), resp_body=body)
diff --git a/tempest/lib/services/volume/__init__.py b/tempest/lib/services/volume/__init__.py
index e69de29..11da06c 100644
--- a/tempest/lib/services/volume/__init__.py
+++ b/tempest/lib/services/volume/__init__.py
@@ -0,0 +1,18 @@
+# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
+#
+# 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.
+
+from tempest.lib.services.volume import v1
+from tempest.lib.services.volume import v2
+
+__all__ = ['v1', 'v2']
diff --git a/tempest/lib/services/volume/v1/__init__.py b/tempest/lib/services/volume/v1/__init__.py
index e69de29..9c98542 100644
--- a/tempest/lib/services/volume/v1/__init__.py
+++ b/tempest/lib/services/volume/v1/__init__.py
@@ -0,0 +1,31 @@
+# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
+#
+# 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.
+
+from tempest.lib.services.volume.v1.availability_zone_client \
+ import AvailabilityZoneClient
+from tempest.lib.services.volume.v1.backups_client import BackupsClient
+from tempest.lib.services.volume.v1.encryption_types_client import \
+ EncryptionTypesClient
+from tempest.lib.services.volume.v1.extensions_client import ExtensionsClient
+from tempest.lib.services.volume.v1.hosts_client import HostsClient
+from tempest.lib.services.volume.v1.qos_client import QosSpecsClient
+from tempest.lib.services.volume.v1.quotas_client import QuotasClient
+from tempest.lib.services.volume.v1.services_client import ServicesClient
+from tempest.lib.services.volume.v1.snapshots_client import SnapshotsClient
+from tempest.lib.services.volume.v1.types_client import TypesClient
+from tempest.lib.services.volume.v1.volumes_client import VolumesClient
+
+__all__ = ['AvailabilityZoneClient', 'BackupsClient', 'EncryptionTypesClient',
+ 'ExtensionsClient', 'HostsClient', 'QosSpecsClient', 'QuotasClient',
+ 'ServicesClient', 'SnapshotsClient', 'TypesClient', 'VolumesClient']
diff --git a/tempest/lib/services/volume/v2/__init__.py b/tempest/lib/services/volume/v2/__init__.py
index e69de29..f547d7d 100644
--- a/tempest/lib/services/volume/v2/__init__.py
+++ b/tempest/lib/services/volume/v2/__init__.py
@@ -0,0 +1,31 @@
+# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
+#
+# 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.
+
+from tempest.lib.services.volume.v2.availability_zone_client \
+ import AvailabilityZoneClient
+from tempest.lib.services.volume.v2.backups_client import BackupsClient
+from tempest.lib.services.volume.v2.encryption_types_client import \
+ EncryptionTypesClient
+from tempest.lib.services.volume.v2.extensions_client import ExtensionsClient
+from tempest.lib.services.volume.v2.hosts_client import HostsClient
+from tempest.lib.services.volume.v2.qos_client import QosSpecsClient
+from tempest.lib.services.volume.v2.quotas_client import QuotasClient
+from tempest.lib.services.volume.v2.services_client import ServicesClient
+from tempest.lib.services.volume.v2.snapshots_client import SnapshotsClient
+from tempest.lib.services.volume.v2.types_client import TypesClient
+from tempest.lib.services.volume.v2.volumes_client import VolumesClient
+
+__all__ = ['AvailabilityZoneClient', 'BackupsClient', 'EncryptionTypesClient',
+ 'ExtensionsClient', 'HostsClient', 'QosSpecsClient', 'QuotasClient',
+ 'ServicesClient', 'SnapshotsClient', 'TypesClient', 'VolumesClient']
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 3a808ce..831be99 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -26,6 +26,7 @@
from tempest.common import image as common_image
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
+from tempest.common.utils import net_utils
from tempest.common import waiters
from tempest import config
from tempest import exceptions
@@ -216,7 +217,7 @@
if size is None:
size = CONF.volume.volume_size
if name is None:
- name = data_utils.rand_name(self.__class__.__name__)
+ name = data_utils.rand_name(self.__class__.__name__ + "-volume")
kwargs = {'display_name': name,
'snapshot_id': snapshot_id,
'imageRef': imageRef,
@@ -417,7 +418,7 @@
# Compute client
_images_client = self.compute_images_client
if name is None:
- name = data_utils.rand_name('scenario-snapshot')
+ name = data_utils.rand_name(self.__class__.__name__ + 'snapshot')
LOG.debug("Creating a snapshot image for server: %s", server['name'])
image = _images_client.create_image(server['id'], name=name)
image_id = image.response['location'].split('images/')[1]
@@ -495,9 +496,18 @@
server_id, 'ACTIVE')
def ping_ip_address(self, ip_address, should_succeed=True,
- ping_timeout=None):
+ ping_timeout=None, mtu=None):
timeout = ping_timeout or CONF.validation.ping_timeout
- cmd = ['ping', '-c1', '-w1', ip_address]
+ cmd = ['ping', '-c1', '-w1']
+
+ if mtu:
+ cmd += [
+ # don't fragment
+ '-M', 'do',
+ # ping receives just the size of ICMP payload
+ '-s', str(net_utils.get_ping_payload_size(mtu, 4))
+ ]
+ cmd.append(ip_address)
def ping():
proc = subprocess.Popen(cmd,
@@ -525,7 +535,8 @@
def check_vm_connectivity(self, ip_address,
username=None,
private_key=None,
- should_connect=True):
+ should_connect=True,
+ mtu=None):
"""Check server connectivity
:param ip_address: server to test against
@@ -534,6 +545,7 @@
:param should_connect: True/False indicates positive/negative test
positive - attempt ping and ssh
negative - attempt ping and fail if succeed
+ :param mtu: network MTU to use for connectivity validation
:raises: AssertError if the result of the connectivity check does
not match the value of the should_connect param
@@ -543,7 +555,8 @@
else:
msg = "ip address %s is reachable" % ip_address
self.assertTrue(self.ping_ip_address(ip_address,
- should_succeed=should_connect),
+ should_succeed=should_connect,
+ mtu=mtu),
msg=msg)
if should_connect:
# no need to check ssh for negative connectivity
@@ -551,7 +564,7 @@
def check_public_network_connectivity(self, ip_address, username,
private_key, should_connect=True,
- msg=None, servers=None):
+ msg=None, servers=None, mtu=None):
# The target login is assumed to have been configured for
# key-based authentication by cloud-init.
LOG.debug('checking network connections to IP %s with user: %s' %
@@ -560,7 +573,8 @@
self.check_vm_connectivity(ip_address,
username,
private_key,
- should_connect=should_connect)
+ should_connect=should_connect,
+ mtu=mtu)
except Exception:
ex_msg = 'Public network connectivity check failed'
if msg:
@@ -789,7 +803,7 @@
def _get_server_port_id_and_ip4(self, server, ip_addr=None):
ports = self._list_ports(device_id=server['id'], fixed_ip=ip_addr)
- # A port can have more then one IP address in some cases.
+ # A port can have more than one IP address in some cases.
# If the network is dual-stack (IPv4 + IPv6), this port is associated
# with 2 subnets
p_status = ['ACTIVE']
diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py
index 43adfb1..8de3561 100644
--- a/tempest/scenario/test_aggregates_basic_ops.py
+++ b/tempest/scenario/test_aggregates_basic_ops.py
@@ -52,7 +52,7 @@
def _get_host_name(self):
hosts = self.hosts_client.list_hosts()['hosts']
- self.assertTrue(len(hosts) >= 1)
+ self.assertGreaterEqual(len(hosts), 1)
computes = [x for x in hosts if x['service'] == 'compute']
return computes[0]['host_name']
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index 3390aff..60b030d 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -15,7 +15,6 @@
import testtools
-from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
from tempest.scenario import manager
@@ -56,9 +55,7 @@
security_group = self._create_security_group()
security_groups = [{'name': security_group['name']}]
network, subnet, router = self.create_networks()
- server_name = data_utils.rand_name(self.__class__.__name__ + '-server')
server = self.create_server(
- name=server_name,
networks=[{'uuid': network['id']}],
key_name=keypair['name'],
security_groups=security_groups,
@@ -98,7 +95,6 @@
self._check_network_connectivity(server, keypair, floating_ip)
@test.idempotent_id('61f1aa9a-1573-410e-9054-afa557cab021')
- @test.stresstest(class_setup_per='process')
@test.services('compute', 'network')
def test_server_connectivity_stop_start(self):
keypair = self.create_keypair()
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index a295b6a..b527c3d 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -183,7 +183,7 @@
def check_public_network_connectivity(
self, should_connect=True, msg=None,
- should_check_floating_ip_status=True):
+ should_check_floating_ip_status=True, mtu=None):
"""Verifies connectivty to a VM via public network and floating IP
and verifies floating IP has resource status is correct.
@@ -195,6 +195,7 @@
to indicate the context of the failure
:param should_check_floating_ip_status: bool. should status of
floating_ip be checked or not
+ :param mtu: int. MTU network to use for connectivity validation
"""
ssh_login = CONF.validation.image_ssh_user
floating_ip, server = self.floating_ip_tuple
@@ -210,7 +211,7 @@
# call the common method in the parent class
super(TestNetworkBasicOps, self).check_public_network_connectivity(
ip_address, ssh_login, private_key, should_connect, msg,
- self.servers)
+ self.servers, mtu=mtu)
def _disassociate_floating_ips(self):
floating_ip, server = self.floating_ip_tuple
@@ -410,6 +411,16 @@
msg="after re-associate "
"floating ip")
+ @test.idempotent_id('b158ea55-472e-4086-8fa9-c64ac0c6c1d0')
+ @testtools.skipUnless(test.is_extension_enabled('net-mtu', 'network'),
+ 'No way to calculate MTU for networks')
+ @test.services('compute', 'network')
+ def test_mtu_sized_frames(self):
+ """Validate that network MTU sized frames fit through."""
+ self._setup_network_and_servers()
+ self.check_public_network_connectivity(
+ should_connect=True, mtu=self.network['mtu'])
+
@test.idempotent_id('1546850e-fbaa-42f5-8b5f-03d8a6a95f15')
@testtools.skipIf(CONF.baremetal.driver_enabled,
'Baremetal relies on a shared physical network.')
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index dd86d90..496f07e 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -18,7 +18,6 @@
from tempest import config
from tempest.lib.common.utils import test_utils
-from tempest.lib import decorators
from tempest.scenario import manager
from tempest import test
@@ -255,7 +254,6 @@
self._prepare_and_test(address6_mode='dhcpv6-stateless', n_subnets6=2,
dualnet=True)
- @decorators.skip_because(bug="1540983")
@test.idempotent_id('9178ad42-10e4-47e9-8987-e02b170cc5cd')
@test.services('compute', 'network')
def test_dualnet_multi_prefix_slaac(self):
diff --git a/tempest/scenario/test_server_multinode.py b/tempest/scenario/test_server_multinode.py
index 333079c..170d220 100644
--- a/tempest/scenario/test_server_multinode.py
+++ b/tempest/scenario/test_server_multinode.py
@@ -47,9 +47,17 @@
@test.attr(type='smoke')
@test.services('compute', 'network')
def test_schedule_to_all_nodes(self):
- host_client = self.manager.hosts_client
- hosts = host_client.list_hosts()['hosts']
- hosts = [x for x in hosts if x['service'] == 'compute']
+ available_zone = \
+ self.os_adm.availability_zone_client.list_availability_zones(
+ detail=True)['availabilityZoneInfo']
+ hosts = []
+ for zone in available_zone:
+ if zone['zoneState']['available']:
+ for host in zone['hosts']:
+ if 'nova-compute' in zone['hosts'][host] and \
+ zone['hosts'][host]['nova-compute']['available']:
+ hosts.append({'zone': zone['zoneName'],
+ 'host_name': host})
# ensure we have at least as many compute hosts as we expect
if len(hosts) < CONF.compute.min_compute_nodes:
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 44ad136..db5e009 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -88,11 +88,6 @@
return snap
- def _create_volume_from_snapshot(self, snap_id):
- vol_name = data_utils.rand_name(
- self.__class__.__name__ + '-volume')
- return self.create_volume(name=vol_name, snapshot_id=snap_id)
-
def _delete_server(self, server):
self.servers_client.delete_server(server['id'])
waiters.wait_for_server_termination(self.servers_client, server['id'])
@@ -153,7 +148,7 @@
# create a 3rd instance from snapshot
LOG.info("Creating third instance from snapshot: %s" % snapshot['id'])
- volume = self._create_volume_from_snapshot(snapshot['id'])
+ volume = self.create_volume(snapshot_id=snapshot['id'])
server_from_snapshot = (
self._boot_instance_from_volume(volume['id'],
keypair, security_group))
@@ -174,8 +169,7 @@
instance = self._boot_instance_from_volume(volume_origin['id'],
delete_on_termination=True)
# create EBS image
- name = data_utils.rand_name(self.__class__.__name__ + '-image')
- image = self.create_server_snapshot(instance, name=name)
+ image = self.create_server_snapshot(instance)
# delete instance
self._delete_server(instance)
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index 5a26bfc..2509156 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -96,28 +96,6 @@
self.expected_success(204, resp.status)
return resp, body
- def list_all_container_objects(self, container, params=None):
- """Returns complete list of all objects in the container
-
- even if item count is beyond 10,000 item listing limit.
- Does not require any parameters aside from container name.
- """
- # TODO(dwalleck): Rewrite using json format to avoid newlines at end of
- # obj names. Set limit to API limit - 1 (max returned items = 9999)
- limit = 9999
- if params is not None:
- if 'limit' in params:
- limit = params['limit']
-
- if 'marker' in params:
- limit = params['marker']
-
- resp, objlist = self.list_container_contents(
- container,
- params={'limit': limit, 'format': 'json'})
- self.expected_success(200, resp.status)
- return objlist
-
def list_container_contents(self, container, params=None):
"""List the objects in a container, given the container name
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index ec36fb7..9445e34 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -164,7 +164,7 @@
chunked=True
)
- self._error_checker('PUT', None, headers, contents, resp, body)
+ self._error_checker(resp, body)
self.expected_success(201, resp.status)
return resp.status, resp.reason, resp
diff --git a/tempest/services/volume/__init__.py b/tempest/services/volume/__init__.py
index 4d29cdd..c62dd53 100644
--- a/tempest/services/volume/__init__.py
+++ b/tempest/services/volume/__init__.py
@@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations under
# the License.
-from tempest.services.volume import v1
-from tempest.services.volume import v2
from tempest.services.volume import v3
-__all__ = ['v1', 'v2', 'v3']
+__all__ = ['v3']
diff --git a/tempest/services/volume/v1/__init__.py b/tempest/services/volume/v1/__init__.py
deleted file mode 100644
index 7fb3ed3..0000000
--- a/tempest/services/volume/v1/__init__.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
-#
-# 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.
-
-from tempest.lib.services.volume.v1.availability_zone_client import \
- AvailabilityZoneClient
-from tempest.lib.services.volume.v1.backups_client import BackupsClient
-from tempest.lib.services.volume.v1.encryption_types_client import \
- EncryptionTypesClient
-from tempest.lib.services.volume.v1.extensions_client import ExtensionsClient
-from tempest.lib.services.volume.v1.hosts_client import HostsClient
-from tempest.lib.services.volume.v1.qos_client import QosSpecsClient
-from tempest.lib.services.volume.v1.quotas_client import QuotasClient
-from tempest.lib.services.volume.v1.services_client import ServicesClient
-from tempest.lib.services.volume.v1.snapshots_client import SnapshotsClient
-from tempest.lib.services.volume.v1.types_client import TypesClient
-from tempest.lib.services.volume.v1.volumes_client import VolumesClient
-
-__all__ = ['AvailabilityZoneClient', 'EncryptionTypesClient',
- 'ExtensionsClient', 'HostsClient', 'QuotasClient',
- 'QosSpecsClient', 'ServicesClient',
- 'SnapshotsClient', 'TypesClient', 'BackupsClient',
- 'VolumesClient', ]
diff --git a/tempest/services/volume/v1/json/__init__.py b/tempest/services/volume/v1/json/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/services/volume/v1/json/__init__.py
+++ /dev/null
diff --git a/tempest/services/volume/v2/__init__.py b/tempest/services/volume/v2/__init__.py
deleted file mode 100644
index 8edaf2a..0000000
--- a/tempest/services/volume/v2/__init__.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
-#
-# 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.
-
-from tempest.lib.services.volume.v2.availability_zone_client import \
- AvailabilityZoneClient
-from tempest.lib.services.volume.v2.backups_client import BackupsClient
-from tempest.lib.services.volume.v2.encryption_types_client import \
- EncryptionTypesClient
-from tempest.lib.services.volume.v2.extensions_client import ExtensionsClient
-from tempest.lib.services.volume.v2.hosts_client import HostsClient
-from tempest.lib.services.volume.v2.qos_client import QosSpecsClient
-from tempest.lib.services.volume.v2.quotas_client import QuotasClient
-from tempest.lib.services.volume.v2.services_client import ServicesClient
-from tempest.lib.services.volume.v2.snapshots_client import SnapshotsClient
-from tempest.lib.services.volume.v2.types_client import TypesClient
-from tempest.lib.services.volume.v2.volumes_client import VolumesClient
-
-__all__ = ['AvailabilityZoneClient', 'BackupsClient', 'EncryptionTypesClient',
- 'ExtensionsClient', 'HostsClient', 'QosSpecsClient', 'QuotasClient',
- 'ServicesClient', 'SnapshotsClient', 'TypesClient',
- 'VolumesClient', ]
diff --git a/tempest/services/volume/v2/json/__init__.py b/tempest/services/volume/v2/json/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/services/volume/v2/json/__init__.py
+++ /dev/null
diff --git a/tempest/stress/README.rst b/tempest/stress/README.rst
deleted file mode 100644
index f22c9ce..0000000
--- a/tempest/stress/README.rst
+++ /dev/null
@@ -1,62 +0,0 @@
-.. _stress_field_guide:
-
-Tempest Field Guide to Stress Tests
-===================================
-
-OpenStack is a distributed, asynchronous system that is prone to race condition
-bugs. These bugs will not be easily found during
-functional testing but will be encountered by users in large deployments in a
-way that is hard to debug. The stress test tries to cause these bugs to happen
-in a more controlled environment.
-
-
-Environment
------------
-This particular framework assumes your working Nova cluster understands Nova
-API 2.0. The stress tests can read the logs from the cluster. To enable this
-you have to provide the hostname to call 'nova-manage' and
-the private key and user name for ssh to the cluster in the
-[stress] section of tempest.conf. You also need to provide the
-location of the log files:
-
- .. code-block:: ini
-
- target_logfiles = "regexp to all log files to be checked for errors"
- target_private_key_path = "private ssh key for controller and log file nodes"
- target_ssh_user = "username for controller and log file nodes"
- target_controller = "hostname or ip of controller node (for nova-manage)
- log_check_interval = "time between checking logs for errors (default 60s)"
-
-To activate logging on your console please make sure that you activate `use_stderr`
-in tempest.conf or use the default `logging.conf.sample` file.
-
-Running default stress test set
--------------------------------
-
-The stress test framework can automatically discover test inside the tempest
-test suite. All test flag with the `@stresstest` decorator will be executed.
-In order to use this discovery you have to install tempest CLI, be in the
-tempest root directory and execute the following:
-
- tempest run-stress -a -d 30
-
-Running the sample test
------------------------
-
-To test installation, do the following:
-
- tempest run-stress -t tempest/stress/etc/server-create-destroy-test.json -d 30
-
-This sample test tries to create a few VMs and kill a few VMs.
-
-
-Additional Tools
-----------------
-
-Sometimes the tests don't finish, or there are failures. In these
-cases, you may want to clean out the nova cluster. We have provided
-some scripts to do this in the ``tools`` subdirectory.
-You can use the following script to destroy any keypairs,
-floating ips, and servers:
-
-tempest/stress/tools/cleanup.py
diff --git a/tempest/stress/__init__.py b/tempest/stress/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/stress/__init__.py
+++ /dev/null
diff --git a/tempest/stress/actions/__init__.py b/tempest/stress/actions/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/stress/actions/__init__.py
+++ /dev/null
diff --git a/tempest/stress/actions/server_create_destroy.py b/tempest/stress/actions/server_create_destroy.py
deleted file mode 100644
index 183bc6c..0000000
--- a/tempest/stress/actions/server_create_destroy.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2013 Quanta Research Cambridge, Inc.
-#
-# 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.
-
-from tempest.common.utils import data_utils
-from tempest.common import waiters
-from tempest import config
-import tempest.stress.stressaction as stressaction
-
-CONF = config.CONF
-
-
-class ServerCreateDestroyTest(stressaction.StressAction):
-
- def setUp(self, **kwargs):
- self.image = CONF.compute.image_ref
- self.flavor = CONF.compute.flavor_ref
-
- def run(self):
- name = data_utils.rand_name(self.__class__.__name__ + "-instance")
- self.logger.info("creating %s" % name)
- server = self.manager.servers_client.create_server(
- name=name, imageRef=self.image, flavorRef=self.flavor)['server']
- server_id = server['id']
- 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)
- waiters.wait_for_server_termination(self.manager.servers_client,
- server_id)
- self.logger.info("deleted %s" % server_id)
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
deleted file mode 100644
index 845b4a7..0000000
--- a/tempest/stress/actions/ssh_floating.py
+++ /dev/null
@@ -1,200 +0,0 @@
-# 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 socket
-import subprocess
-
-from tempest.common.utils import data_utils
-from tempest.common import waiters
-from tempest import config
-from tempest.lib.common.utils import test_utils
-import tempest.stress.stressaction as stressaction
-
-CONF = config.CONF
-
-
-class FloatingStress(stressaction.StressAction):
-
- # from the scenario manager
- def ping_ip_address(self, ip_address):
- cmd = ['ping', '-c1', '-w1', ip_address]
-
- proc = subprocess.Popen(cmd,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- proc.communicate()
- success = proc.returncode == 0
- return success
-
- def tcp_connect_scan(self, addr, port):
- # like tcp
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- try:
- s.connect((addr, port))
- except socket.error as exc:
- self.logger.info("%s(%s): %s", self.server_id, self.floating['ip'],
- str(exc))
- return False
- self.logger.info("%s(%s): Connected :)", self.server_id,
- self.floating['ip'])
- s.close()
- return True
-
- def check_port_ssh(self):
- def func():
- return self.tcp_connect_scan(self.floating['ip'], 22)
- if not test_utils.call_until_true(func, self.check_timeout,
- self.check_interval):
- raise RuntimeError("Cannot connect to the ssh port.")
-
- def check_icmp_echo(self):
- self.logger.info("%s(%s): Pinging..",
- self.server_id, self.floating['ip'])
-
- def func():
- return self.ping_ip_address(self.floating['ip'])
- if not test_utils.call_until_true(func, self.check_timeout,
- self.check_interval):
- raise RuntimeError("%s(%s): Cannot ping the machine.",
- self.server_id, self.floating['ip'])
- self.logger.info("%s(%s): pong :)",
- self.server_id, self.floating['ip'])
-
- def _create_vm(self):
- self.name = name = data_utils.rand_name(
- self.__class__.__name__ + "-instance")
- servers_client = self.manager.servers_client
- self.logger.info("creating %s" % name)
- vm_args = self.vm_extra_args.copy()
- vm_args['security_groups'] = [self.sec_grp]
- server = servers_client.create_server(name=name, imageRef=self.image,
- flavorRef=self.flavor,
- **vm_args)['server']
- self.server_id = server['id']
- if self.wait_after_vm_create:
- 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)
- self.manager.servers_client.delete_server(self.server_id)
- waiters.wait_for_server_termination(self.manager.servers_client,
- self.server_id)
- self.logger.info("deleted %s" % self.server_id)
-
- def _create_sec_group(self):
- sec_grp_cli = self.manager.compute_security_groups_client
- s_name = data_utils.rand_name(self.__class__.__name__ + '-sec_grp')
- s_description = data_utils.rand_name('desc')
- self.sec_grp = sec_grp_cli.create_security_group(
- name=s_name, description=s_description)['security_group']
- create_rule = sec_grp_cli.create_security_group_rule
- create_rule(parent_group_id=self.sec_grp['id'], ip_protocol='tcp',
- from_port=22, to_port=22)
- create_rule(parent_group_id=self.sec_grp['id'], ip_protocol='icmp',
- from_port=-1, to_port=-1)
-
- def _destroy_sec_grp(self):
- sec_grp_cli = self.manager.compute_security_groups_client
- sec_grp_cli.delete_security_group(self.sec_grp['id'])
-
- def _create_floating_ip(self):
- floating_cli = self.manager.compute_floating_ips_client
- self.floating = (floating_cli.create_floating_ip(self.floating_pool)
- ['floating_ip'])
-
- def _destroy_floating_ip(self):
- cli = self.manager.compute_floating_ips_client
- cli.delete_floating_ip(self.floating['id'])
- cli.wait_for_resource_deletion(self.floating['id'])
- self.logger.info("Deleted Floating IP %s", str(self.floating['ip']))
-
- def setUp(self, **kwargs):
- self.image = CONF.compute.image_ref
- self.flavor = CONF.compute.flavor_ref
- self.vm_extra_args = kwargs.get('vm_extra_args', {})
- self.wait_after_vm_create = kwargs.get('wait_after_vm_create',
- True)
- self.new_vm = kwargs.get('new_vm', False)
- self.new_sec_grp = kwargs.get('new_sec_group', False)
- self.new_floating = kwargs.get('new_floating', False)
- self.reboot = kwargs.get('reboot', False)
- self.floating_pool = kwargs.get('floating_pool', None)
- self.verify = kwargs.get('verify', ('check_port_ssh',
- 'check_icmp_echo'))
- self.check_timeout = kwargs.get('check_timeout', 120)
- self.check_interval = kwargs.get('check_interval', 1)
- self.wait_for_disassociate = kwargs.get('wait_for_disassociate',
- True)
-
- # allocate floating
- if not self.new_floating:
- self._create_floating_ip()
- # add security group
- if not self.new_sec_grp:
- self._create_sec_group()
- # create vm
- if not self.new_vm:
- self._create_vm()
-
- def wait_disassociate(self):
- cli = self.manager.compute_floating_ips_client
-
- def func():
- floating = (cli.show_floating_ip(self.floating['id'])
- ['floating_ip'])
- return floating['instance_id'] is None
-
- if not test_utils.call_until_true(func, self.check_timeout,
- self.check_interval):
- raise RuntimeError("IP disassociate timeout!")
-
- def run_core(self):
- cli = self.manager.compute_floating_ips_client
- cli.associate_floating_ip_to_server(self.floating['ip'],
- self.server_id)
- for method in self.verify:
- m = getattr(self, method)
- m()
- cli.disassociate_floating_ip_from_server(self.floating['ip'],
- self.server_id)
- if self.wait_for_disassociate:
- self.wait_disassociate()
-
- def run(self):
- if self.new_sec_grp:
- self._create_sec_group()
- if self.new_floating:
- self._create_floating_ip()
- if self.new_vm:
- self._create_vm()
- if self.reboot:
- self.manager.servers_client.reboot(self.server_id, 'HARD')
- waiters.wait_for_server_status(self.manager.servers_client,
- self.server_id, 'ACTIVE')
-
- self.run_core()
-
- if self.new_vm:
- self._destroy_vm()
- if self.new_floating:
- self._destroy_floating_ip()
- if self.new_sec_grp:
- self._destroy_sec_grp()
-
- def tearDown(self):
- if not self.new_vm:
- self._destroy_vm()
- if not self.new_floating:
- self._destroy_floating_ip()
- if not self.new_sec_grp:
- self._destroy_sec_grp()
diff --git a/tempest/stress/actions/unit_test.py b/tempest/stress/actions/unit_test.py
deleted file mode 100644
index e016c61..0000000
--- a/tempest/stress/actions/unit_test.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# 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.
-
-from oslo_log import log as logging
-from oslo_utils import importutils
-
-from tempest import config
-import tempest.stress.stressaction as stressaction
-
-CONF = config.CONF
-
-
-class SetUpClassRunTime(object):
-
- process = 'process'
- action = 'action'
- application = 'application'
-
- allowed = set((process, action, application))
-
- @classmethod
- def validate(cls, name):
- if name not in cls.allowed:
- raise KeyError("\'%s\' not a valid option" % name)
-
-
-class UnitTest(stressaction.StressAction):
- """This is a special action for running existing unittests as stress test.
-
- You need to pass ``test_method`` and ``class_setup_per``
- using ``kwargs`` in the JSON descriptor;
- ``test_method`` should be the fully qualified name of a unittest,
- ``class_setup_per`` should be one from:
- ``application``: once in the stress job lifetime
- ``process``: once in the worker process lifetime
- ``action``: on each action
- Not all combination working in every case.
- """
-
- def setUp(self, **kwargs):
- method = kwargs['test_method'].split('.')
- self.test_method = method.pop()
- self.klass = importutils.import_class('.'.join(method))
- self.logger = logging.getLogger('.'.join(method))
- # valid options are 'process', 'application' , 'action'
- self.class_setup_per = kwargs.get('class_setup_per',
- SetUpClassRunTime.process)
- SetUpClassRunTime.validate(self.class_setup_per)
-
- if self.class_setup_per == SetUpClassRunTime.application:
- self.klass.setUpClass()
- self.setupclass_called = False
-
- @property
- def action(self):
- if self.test_method:
- return self.test_method
- return super(UnitTest, self).action
-
- def run_core(self):
- res = self.klass(self.test_method).run()
- if res.errors:
- raise RuntimeError(res.errors)
-
- def run(self):
- if self.class_setup_per != SetUpClassRunTime.application:
- if (self.class_setup_per == SetUpClassRunTime.action
- or self.setupclass_called is False):
- self.klass.setUpClass()
- self.setupclass_called = True
-
- try:
- self.run_core()
- finally:
- if (CONF.stress.leave_dirty_stack is False
- and self.class_setup_per == SetUpClassRunTime.action):
- self.klass.tearDownClass()
- else:
- self.run_core()
-
- def tearDown(self):
- if self.class_setup_per != SetUpClassRunTime.action:
- self.klass.tearDownClass()
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
deleted file mode 100644
index 5fc006e..0000000
--- a/tempest/stress/actions/volume_attach_delete.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# (c) 2013 Deutsche Telekom AG
-# 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.
-
-from tempest.common.utils import data_utils
-from tempest.common import waiters
-from tempest import config
-import tempest.stress.stressaction as stressaction
-
-CONF = config.CONF
-
-
-class VolumeAttachDeleteTest(stressaction.StressAction):
-
- def setUp(self, **kwargs):
- self.image = CONF.compute.image_ref
- self.flavor = CONF.compute.flavor_ref
-
- def run(self):
- # Step 1: create volume
- name = data_utils.rand_name(self.__class__.__name__ + "-volume")
- self.logger.info("creating volume: %s" % name)
- volume = self.manager.volumes_client.create_volume(
- display_name=name, size=CONF.volume.volume_size)['volume']
- self.manager.volumes_client.wait_for_volume_status(volume['id'],
- 'available')
- self.logger.info("created volume: %s" % volume['id'])
-
- # Step 2: create vm instance
- vm_name = data_utils.rand_name(self.__class__.__name__ + "-instance")
- self.logger.info("creating vm: %s" % vm_name)
- server = self.manager.servers_client.create_server(
- name=vm_name, imageRef=self.image, flavorRef=self.flavor)['server']
- server_id = server['id']
- 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
- self.logger.info("attach volume (%s) to vm %s" %
- (volume['id'], server_id))
- self.manager.servers_client.attach_volume(server_id,
- volumeId=volume['id'],
- device='/dev/vdc')
- self.manager.volumes_client.wait_for_volume_status(volume['id'],
- 'in-use')
- self.logger.info("volume (%s) attached to vm %s" %
- (volume['id'], server_id))
-
- # Step 4: delete vm
- self.logger.info("deleting vm: %s" % vm_name)
- self.manager.servers_client.delete_server(server_id)
- waiters.wait_for_server_termination(self.manager.servers_client,
- server_id)
- self.logger.info("deleted vm: %s" % server_id)
-
- # Step 5: delete volume
- self.logger.info("deleting volume: %s" % volume['id'])
- self.manager.volumes_client.delete_volume(volume['id'])
- self.manager.volumes_client.wait_for_resource_deletion(volume['id'])
- self.logger.info("deleted volume: %s" % volume['id'])
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
deleted file mode 100644
index 4fbb851..0000000
--- a/tempest/stress/actions/volume_attach_verify.py
+++ /dev/null
@@ -1,233 +0,0 @@
-# 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 re
-
-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.lib.common.utils import test_utils
-import tempest.stress.stressaction as stressaction
-
-CONF = config.CONF
-
-
-class VolumeVerifyStress(stressaction.StressAction):
-
- def _create_keypair(self):
- keyname = data_utils.rand_name("key")
- self.key = (self.manager.keypairs_client.create_keypair(name=keyname)
- ['keypair'])
-
- def _delete_keypair(self):
- self.manager.keypairs_client.delete_keypair(self.key['name'])
-
- def _create_vm(self):
- self.name = name = data_utils.rand_name(
- self.__class__.__name__ + "-instance")
- servers_client = self.manager.servers_client
- self.logger.info("creating %s" % name)
- vm_args = self.vm_extra_args.copy()
- vm_args['security_groups'] = [self.sec_grp]
- vm_args['key_name'] = self.key['name']
- server = servers_client.create_server(name=name, imageRef=self.image,
- flavorRef=self.flavor,
- **vm_args)['server']
- self.server_id = server['id']
- 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)
- self.manager.servers_client.delete_server(self.server_id)
- waiters.wait_for_server_termination(self.manager.servers_client,
- self.server_id)
- self.logger.info("deleted server: %s" % self.server_id)
-
- def _create_sec_group(self):
- sec_grp_cli = self.manager.compute_security_groups_client
- s_name = data_utils.rand_name(self.__class__.__name__ + '-sec_grp')
- s_description = data_utils.rand_name('desc')
- self.sec_grp = sec_grp_cli.create_security_group(
- name=s_name, description=s_description)['security_group']
- create_rule = sec_grp_cli.create_security_group_rule
- create_rule(parent_group_id=self.sec_grp['id'], ip_protocol='tcp',
- from_port=22, to_port=22)
- create_rule(parent_group_id=self.sec_grp['id'], ip_protocol='icmp',
- from_port=-1, to_port=-1)
-
- def _destroy_sec_grp(self):
- sec_grp_cli = self.manager.compute_security_groups_client
- sec_grp_cli.delete_security_group(self.sec_grp['id'])
-
- def _create_floating_ip(self):
- floating_cli = self.manager.compute_floating_ips_client
- self.floating = (floating_cli.create_floating_ip(self.floating_pool)
- ['floating_ip'])
-
- def _destroy_floating_ip(self):
- cli = self.manager.compute_floating_ips_client
- cli.delete_floating_ip(self.floating['id'])
- cli.wait_for_resource_deletion(self.floating['id'])
- self.logger.info("Deleted Floating IP %s", str(self.floating['ip']))
-
- def _create_volume(self):
- name = data_utils.rand_name(self.__class__.__name__ + "-volume")
- self.logger.info("creating volume: %s" % name)
- volumes_client = self.manager.volumes_client
- self.volume = volumes_client.create_volume(
- display_name=name, size=CONF.volume.volume_size)['volume']
- volumes_client.wait_for_volume_status(self.volume['id'],
- 'available')
- self.logger.info("created volume: %s" % self.volume['id'])
-
- def _delete_volume(self):
- self.logger.info("deleting volume: %s" % self.volume['id'])
- volumes_client = self.manager.volumes_client
- volumes_client.delete_volume(self.volume['id'])
- volumes_client.wait_for_resource_deletion(self.volume['id'])
- self.logger.info("deleted volume: %s" % self.volume['id'])
-
- def _wait_disassociate(self):
- cli = self.manager.compute_floating_ips_client
-
- def func():
- floating = (cli.show_floating_ip(self.floating['id'])
- ['floating_ip'])
- return floating['instance_id'] is None
-
- if not test_utils.call_until_true(func, CONF.compute.build_timeout,
- CONF.compute.build_interval):
- raise RuntimeError("IP disassociate timeout!")
-
- def new_server_ops(self):
- self._create_vm()
- cli = self.manager.compute_floating_ips_client
- cli.associate_floating_ip_to_server(self.floating['ip'],
- self.server_id)
- if self.ssh_test_before_attach and self.enable_ssh_verify:
- self.logger.info("Scanning for block devices via ssh on %s"
- % self.server_id)
- self.part_wait(self.detach_match_count)
-
- def setUp(self, **kwargs):
- """Note able configuration combinations:
-
- Closest options to the test_stamp_pattern:
- new_server = True
- new_volume = True
- enable_ssh_verify = True
- ssh_test_before_attach = False
- Just attaching:
- new_server = False
- new_volume = False
- enable_ssh_verify = True
- ssh_test_before_attach = True
- Mostly API load by repeated attachment:
- new_server = False
- new_volume = False
- enable_ssh_verify = False
- ssh_test_before_attach = False
- Minimal Nova load, but cinder load not decreased:
- new_server = False
- new_volume = True
- enable_ssh_verify = True
- ssh_test_before_attach = True
- """
- self.image = CONF.compute.image_ref
- self.flavor = CONF.compute.flavor_ref
- self.vm_extra_args = kwargs.get('vm_extra_args', {})
- self.floating_pool = kwargs.get('floating_pool', None)
- self.new_volume = kwargs.get('new_volume', True)
- self.new_server = kwargs.get('new_server', False)
- self.enable_ssh_verify = kwargs.get('enable_ssh_verify', True)
- self.ssh_test_before_attach = kwargs.get('ssh_test_before_attach',
- False)
- self.part_line_re = re.compile(kwargs.get('part_line_re', '.*vd.*'))
- self.detach_match_count = kwargs.get('detach_match_count', 1)
- self.attach_match_count = kwargs.get('attach_match_count', 2)
- self.part_name = kwargs.get('part_name', '/dev/vdc')
-
- self._create_floating_ip()
- self._create_sec_group()
- self._create_keypair()
- private_key = self.key['private_key']
- username = CONF.validation.image_ssh_user
- self.remote_client = remote_client.RemoteClient(self.floating['ip'],
- username,
- pkey=private_key)
- if not self.new_volume:
- self._create_volume()
- if not self.new_server:
- self.new_server_ops()
-
- # now we just test that the number of partitions has increased or decreased
- def part_wait(self, num_match):
- def _part_state():
- self.partitions = self.remote_client.get_partitions().split('\n')
- matching = 0
- for part_line in self.partitions[1:]:
- if self.part_line_re.match(part_line):
- matching += 1
- return matching == num_match
- if test_utils.call_until_true(_part_state,
- CONF.compute.build_timeout,
- CONF.compute.build_interval):
- return
- else:
- raise RuntimeError("Unexpected partitions: %s",
- str(self.partitions))
-
- def run(self):
- if self.new_server:
- self.new_server_ops()
- if self.new_volume:
- self._create_volume()
- servers_client = self.manager.servers_client
- self.logger.info("attach volume (%s) to vm %s" %
- (self.volume['id'], self.server_id))
- servers_client.attach_volume(self.server_id,
- volumeId=self.volume['id'],
- device=self.part_name)
- self.manager.volumes_client.wait_for_volume_status(self.volume['id'],
- 'in-use')
- if self.enable_ssh_verify:
- self.logger.info("Scanning for new block device on %s"
- % self.server_id)
- self.part_wait(self.attach_match_count)
-
- servers_client.detach_volume(self.server_id,
- self.volume['id'])
- self.manager.volumes_client.wait_for_volume_status(self.volume['id'],
- 'available')
- if self.enable_ssh_verify:
- self.logger.info("Scanning for block device disappearance on %s"
- % self.server_id)
- self.part_wait(self.detach_match_count)
- if self.new_volume:
- self._delete_volume()
- if self.new_server:
- self._destroy_vm()
-
- def tearDown(self):
- cli = self.manager.compute_floating_ips_client
- cli.disassociate_floating_ip_from_server(self.floating['ip'],
- self.server_id)
- self._wait_disassociate()
- if not self.new_server:
- self._destroy_vm()
- self._delete_keypair()
- self._destroy_floating_ip()
- self._destroy_sec_grp()
- if not self.new_volume:
- self._delete_volume()
diff --git a/tempest/stress/actions/volume_create_delete.py b/tempest/stress/actions/volume_create_delete.py
deleted file mode 100644
index 66971ea..0000000
--- a/tempest/stress/actions/volume_create_delete.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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.
-
-from tempest.common.utils import data_utils
-from tempest import config
-import tempest.stress.stressaction as stressaction
-
-CONF = config.CONF
-
-
-class VolumeCreateDeleteTest(stressaction.StressAction):
-
- def run(self):
- name = data_utils.rand_name("volume")
- self.logger.info("creating %s" % name)
- volumes_client = self.manager.volumes_client
- volume = volumes_client.create_volume(
- display_name=name, size=CONF.volume.volume_size)['volume']
- vol_id = volume['id']
- volumes_client.wait_for_volume_status(vol_id, 'available')
- self.logger.info("created %s" % volume['id'])
- self.logger.info("deleting %s" % name)
- volumes_client.delete_volume(vol_id)
- volumes_client.wait_for_resource_deletion(vol_id)
- self.logger.info("deleted %s" % vol_id)
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
deleted file mode 100644
index 3b0a937..0000000
--- a/tempest/stress/cleanup.py
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2013 Quanta Research Cambridge, Inc.
-#
-# 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.
-
-from oslo_log import log as logging
-
-from tempest.common import credentials_factory as credentials
-from tempest.common import waiters
-
-LOG = logging.getLogger(__name__)
-
-
-def cleanup():
- admin_manager = credentials.AdminManager()
-
- body = admin_manager.servers_client.list_servers(all_tenants=True)
- LOG.info("Cleanup::remove %s servers" % len(body['servers']))
- for s in body['servers']:
- try:
- admin_manager.servers_client.delete_server(s['id'])
- except Exception:
- pass
-
- for s in body['servers']:
- try:
- waiters.wait_for_server_termination(admin_manager.servers_client,
- s['id'])
- except Exception:
- pass
-
- keypairs = admin_manager.keypairs_client.list_keypairs()['keypairs']
- LOG.info("Cleanup::remove %s keypairs" % len(keypairs))
- for k in keypairs:
- try:
- admin_manager.keypairs_client.delete_keypair(k['name'])
- except Exception:
- pass
-
- secgrp_client = admin_manager.compute_security_groups_client
- secgrp = (secgrp_client.list_security_groups(all_tenants=True)
- ['security_groups'])
- 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:
- try:
- secgrp_client.delete_security_group(g['id'])
- except Exception:
- pass
-
- admin_floating_ips_client = admin_manager.compute_floating_ips_client
- floating_ips = (admin_floating_ips_client.list_floating_ips()
- ['floating_ips'])
- LOG.info("Cleanup::remove %s floating ips" % len(floating_ips))
- for f in floating_ips:
- try:
- admin_floating_ips_client.delete_floating_ip(f['id'])
- except Exception:
- pass
-
- users = admin_manager.users_client.list_users()['users']
- LOG.info("Cleanup::remove %s users" % len(users))
- for user in users:
- if user['name'].startswith("stress_user"):
- admin_manager.users_client.delete_user(user['id'])
- tenants = admin_manager.tenants_client.list_tenants()['tenants']
- LOG.info("Cleanup::remove %s tenants" % len(tenants))
- for tenant in tenants:
- if tenant['name'].startswith("stress_tenant"):
- admin_manager.tenants_client.delete_tenant(tenant['id'])
-
- # We have to delete snapshots first or
- # volume deletion may block
-
- _, snaps = admin_manager.snapshots_client.list_snapshots(
- all_tenants=True)['snapshots']
- LOG.info("Cleanup::remove %s snapshots" % len(snaps))
- for v in snaps:
- try:
- waiters.wait_for_snapshot_status(
- admin_manager.snapshots_client, v['id'], 'available')
- admin_manager.snapshots_client.delete_snapshot(v['id'])
- except Exception:
- pass
-
- for v in snaps:
- try:
- admin_manager.snapshots_client.wait_for_resource_deletion(v['id'])
- except Exception:
- pass
-
- vols = admin_manager.volumes_client.list_volumes(
- params={"all_tenants": True})
- LOG.info("Cleanup::remove %s volumes" % len(vols))
- for v in vols:
- try:
- waiters.wait_for_volume_status(
- admin_manager.volumes_client, v['id'], 'available')
- admin_manager.volumes_client.delete_volume(v['id'])
- except Exception:
- pass
-
- for v in vols:
- try:
- admin_manager.volumes_client.wait_for_resource_deletion(v['id'])
- except Exception:
- pass
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
deleted file mode 100644
index 1e33e88..0000000
--- a/tempest/stress/driver.py
+++ /dev/null
@@ -1,264 +0,0 @@
-# Copyright 2013 Quanta Research Cambridge, Inc.
-#
-# 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 multiprocessing
-import os
-import signal
-import time
-
-from oslo_log import log as logging
-from oslo_utils import importutils
-import six
-
-from tempest import clients
-from tempest.common import cred_client
-from tempest.common import credentials_factory as credentials
-from tempest.common.utils import data_utils
-from tempest import config
-from tempest import exceptions
-from tempest.lib.common import ssh
-from tempest.stress import cleanup
-
-CONF = config.CONF
-
-LOG = logging.getLogger(__name__)
-processes = []
-
-
-def do_ssh(command, host, ssh_user, ssh_key=None):
- ssh_client = ssh.Client(host, ssh_user, key_filename=ssh_key)
- try:
- return ssh_client.exec_command(command)
- except exceptions.SSHExecCommandFailed:
- LOG.error('do_ssh raise exception. command:%s, host:%s.'
- % (command, host))
- return None
-
-
-def _get_compute_nodes(controller, ssh_user, ssh_key=None):
- """Returns a list of active compute nodes.
-
- List is generated by running nova-manage on the controller.
- """
- nodes = []
- cmd = "nova-manage service list | grep ^nova-compute"
- output = do_ssh(cmd, controller, ssh_user, ssh_key)
- if not output:
- return nodes
- # For example: nova-compute xg11eth0 nova enabled :-) 2011-10-31 18:57:46
- # This is fragile but there is, at present, no other way to get this info.
- for line in output.split('\n'):
- words = line.split()
- if len(words) > 0 and words[4] == ":-)":
- nodes.append(words[1])
- return nodes
-
-
-def _has_error_in_logs(logfiles, nodes, ssh_user, ssh_key=None,
- stop_on_error=False):
- """Detect errors in nova log files on the controller and compute nodes."""
- grep = 'egrep "ERROR|TRACE" %s' % logfiles
- ret = False
- for node in nodes:
- errors = do_ssh(grep, node, ssh_user, ssh_key)
- if len(errors) > 0:
- LOG.error('%s: %s' % (node, errors))
- ret = True
- if stop_on_error:
- break
- return ret
-
-
-def sigchld_handler(signalnum, frame):
- """Signal handler (only active if stop_on_error is True)."""
- for process in processes:
- if (not process['process'].is_alive() and
- process['process'].exitcode != 0):
- signal.signal(signalnum, signal.SIG_DFL)
- terminate_all_processes()
- break
-
-
-def terminate_all_processes(check_interval=20):
- """Goes through the process list and terminates all child processes."""
- LOG.info("Stopping all processes.")
- for process in processes:
- if process['process'].is_alive():
- try:
- process['process'].terminate()
- except Exception:
- pass
- time.sleep(check_interval)
- for process in processes:
- if process['process'].is_alive():
- try:
- pid = process['process'].pid
- LOG.warning("Process %d hangs. Send SIGKILL." % pid)
- os.kill(pid, signal.SIGKILL)
- except Exception:
- pass
- process['process'].join()
-
-
-def stress_openstack(tests, duration, max_runs=None, stop_on_error=False):
- """Workload driver. Executes an action function against a nova-cluster."""
- admin_manager = credentials.AdminManager()
-
- ssh_user = CONF.stress.target_ssh_user
- ssh_key = CONF.stress.target_private_key_path
- logfiles = CONF.stress.target_logfiles
- log_check_interval = int(CONF.stress.log_check_interval)
- default_thread_num = int(CONF.stress.default_thread_number_per_action)
- if logfiles:
- controller = CONF.stress.target_controller
- computes = _get_compute_nodes(controller, ssh_user, ssh_key)
- for node in computes:
- do_ssh("rm -f %s" % logfiles, node, ssh_user, ssh_key)
- skip = False
- for test in tests:
- for service in test.get('required_services', []):
- if not CONF.service_available.get(service):
- skip = True
- break
- if skip:
- break
- # TODO(andreaf) This has to be reworked to use the credential
- # provider interface. For now only tests marked as 'use_admin' will
- # work.
- if test.get('use_admin', False):
- manager = admin_manager
- else:
- raise NotImplemented('Non admin tests are not supported')
- for p_number in range(test.get('threads', default_thread_num)):
- if test.get('use_isolated_tenants', False):
- username = data_utils.rand_name("stress_user")
- tenant_name = data_utils.rand_name("stress_tenant")
- password = "pass"
- if CONF.identity.auth_version == 'v2':
- identity_client = admin_manager.identity_client
- projects_client = admin_manager.tenants_client
- roles_client = admin_manager.roles_client
- users_client = admin_manager.users_client
- domains_client = None
- else:
- identity_client = admin_manager.identity_v3_client
- projects_client = admin_manager.projects_client
- roles_client = admin_manager.roles_v3_client
- users_client = admin_manager.users_v3_client
- domains_client = admin_manager.domains_client
- domain = (identity_client.auth_provider.credentials.
- get('project_domain_name', 'Default'))
- credentials_client = cred_client.get_creds_client(
- identity_client, projects_client, users_client,
- roles_client, domains_client, project_domain_name=domain)
- project = credentials_client.create_project(
- name=tenant_name, description=tenant_name)
- user = credentials_client.create_user(username, password,
- project, "email")
- # Add roles specified in config file
- for conf_role in CONF.auth.tempest_roles:
- credentials_client.assign_user_role(user, project,
- conf_role)
- creds = credentials_client.get_credentials(user, project,
- password)
- manager = clients.Manager(credentials=creds)
-
- test_obj = importutils.import_class(test['action'])
- test_run = test_obj(manager, max_runs, stop_on_error)
-
- kwargs = test.get('kwargs', {})
- test_run.setUp(**dict(six.iteritems(kwargs)))
-
- LOG.debug("calling Target Object %s" %
- test_run.__class__.__name__)
-
- mp_manager = multiprocessing.Manager()
- shared_statistic = mp_manager.dict()
- shared_statistic['runs'] = 0
- shared_statistic['fails'] = 0
-
- p = multiprocessing.Process(target=test_run.execute,
- args=(shared_statistic,))
-
- process = {'process': p,
- 'p_number': p_number,
- 'action': test_run.action,
- 'statistic': shared_statistic}
-
- processes.append(process)
- p.start()
- if stop_on_error:
- # NOTE(mkoderer): only the parent should register the handler
- signal.signal(signal.SIGCHLD, sigchld_handler)
- end_time = time.time() + duration
- had_errors = False
- try:
- while True:
- if max_runs is None:
- remaining = end_time - time.time()
- if remaining <= 0:
- break
- else:
- remaining = log_check_interval
- all_proc_term = True
- for process in processes:
- if process['process'].is_alive():
- all_proc_term = False
- break
- if all_proc_term:
- break
-
- time.sleep(min(remaining, log_check_interval))
- if stop_on_error:
- if any([True for proc in processes
- if proc['statistic']['fails'] > 0]):
- break
-
- if not logfiles:
- continue
- if _has_error_in_logs(logfiles, computes, ssh_user, ssh_key,
- stop_on_error):
- had_errors = True
- break
- except KeyboardInterrupt:
- LOG.warning("Interrupted, going to print statistics and exit ...")
-
- if stop_on_error:
- signal.signal(signal.SIGCHLD, signal.SIG_DFL)
- terminate_all_processes()
-
- sum_fails = 0
- sum_runs = 0
-
- LOG.info("Statistics (per process):")
- for process in processes:
- if process['statistic']['fails'] > 0:
- had_errors = True
- sum_runs += process['statistic']['runs']
- sum_fails += process['statistic']['fails']
- print("Process %d (%s): Run %d actions (%d failed)" % (
- process['p_number'],
- process['action'],
- process['statistic']['runs'],
- process['statistic']['fails']))
- print("Summary:")
- print("Run %d actions (%d failed)" % (sum_runs, sum_fails))
-
- if not had_errors and CONF.stress.full_clean_stack:
- LOG.info("cleaning up")
- cleanup.cleanup()
- if had_errors:
- return 1
- else:
- return 0
diff --git a/tempest/stress/etc/sample-unit-test.json b/tempest/stress/etc/sample-unit-test.json
deleted file mode 100644
index 54433d5..0000000
--- a/tempest/stress/etc/sample-unit-test.json
+++ /dev/null
@@ -1,8 +0,0 @@
-[{"action": "tempest.stress.actions.unit_test.UnitTest",
- "threads": 8,
- "use_admin": true,
- "use_isolated_tenants": true,
- "kwargs": {"test_method": "tempest.cli.simple_read_only.test_glance.SimpleReadOnlyGlanceClientTest.test_glance_fake_action",
- "class_setup_per": "process"}
- }
-]
diff --git a/tempest/stress/etc/server-create-destroy-test.json b/tempest/stress/etc/server-create-destroy-test.json
deleted file mode 100644
index bbb5352..0000000
--- a/tempest/stress/etc/server-create-destroy-test.json
+++ /dev/null
@@ -1,7 +0,0 @@
-[{"action": "tempest.stress.actions.server_create_destroy.ServerCreateDestroyTest",
- "threads": 8,
- "use_admin": true,
- "use_isolated_tenants": true,
- "kwargs": {}
- }
-]
diff --git a/tempest/stress/etc/ssh_floating.json b/tempest/stress/etc/ssh_floating.json
deleted file mode 100644
index c502e96..0000000
--- a/tempest/stress/etc/ssh_floating.json
+++ /dev/null
@@ -1,16 +0,0 @@
-[{"action": "tempest.stress.actions.ssh_floating.FloatingStress",
- "threads": 8,
- "use_admin": true,
- "use_isolated_tenants": true,
- "kwargs": {"vm_extra_args": {},
- "new_vm": true,
- "new_sec_group": true,
- "new_floating": true,
- "verify": ["check_icmp_echo", "check_port_ssh"],
- "check_timeout": 120,
- "check_interval": 1,
- "wait_after_vm_create": true,
- "wait_for_disassociate": true,
- "reboot": false}
-}
-]
diff --git a/tempest/stress/etc/stress-tox-job.json b/tempest/stress/etc/stress-tox-job.json
deleted file mode 100644
index bfa448d..0000000
--- a/tempest/stress/etc/stress-tox-job.json
+++ /dev/null
@@ -1,28 +0,0 @@
-[{"action": "tempest.stress.actions.server_create_destroy.ServerCreateDestroyTest",
- "threads": 8,
- "use_admin": true,
- "use_isolated_tenants": true,
- "kwargs": {}
- },
- {"action": "tempest.stress.actions.volume_create_delete.VolumeCreateDeleteTest",
- "threads": 4,
- "use_admin": true,
- "use_isolated_tenants": true,
- "kwargs": {}
- },
- {"action": "tempest.stress.actions.volume_attach_delete.VolumeAttachDeleteTest",
- "threads": 2,
- "use_admin": true,
- "use_isolated_tenants": true,
- "kwargs": {}
- },
- {"action": "tempest.stress.actions.unit_test.UnitTest",
- "threads": 4,
- "use_admin": true,
- "use_isolated_tenants": true,
- "required_services": ["neutron"],
- "kwargs": {"test_method": "tempest.scenario.test_network_advanced_server_ops.TestNetworkAdvancedServerOps.test_server_connectivity_stop_start",
- "class_setup_per": "process"}
- }
-]
-
diff --git a/tempest/stress/etc/volume-attach-delete-test.json b/tempest/stress/etc/volume-attach-delete-test.json
deleted file mode 100644
index d468967..0000000
--- a/tempest/stress/etc/volume-attach-delete-test.json
+++ /dev/null
@@ -1,7 +0,0 @@
-[{"action": "tempest.stress.actions.volume_attach_delete.VolumeAttachDeleteTest",
- "threads": 4,
- "use_admin": true,
- "use_isolated_tenants": true,
- "kwargs": {}
- }
-]
diff --git a/tempest/stress/etc/volume-attach-verify.json b/tempest/stress/etc/volume-attach-verify.json
deleted file mode 100644
index d8c96fd..0000000
--- a/tempest/stress/etc/volume-attach-verify.json
+++ /dev/null
@@ -1,11 +0,0 @@
-[{"action": "tempest.stress.actions.volume_attach_verify.VolumeVerifyStress",
- "threads": 1,
- "use_admin": true,
- "use_isolated_tenants": true,
- "kwargs": {"vm_extra_args": {},
- "new_volume": true,
- "new_server": false,
- "ssh_test_before_attach": false,
- "enable_ssh_verify": true}
-}
-]
diff --git a/tempest/stress/etc/volume-create-delete-test.json b/tempest/stress/etc/volume-create-delete-test.json
deleted file mode 100644
index a60cde6..0000000
--- a/tempest/stress/etc/volume-create-delete-test.json
+++ /dev/null
@@ -1,7 +0,0 @@
-[{"action": "tempest.stress.actions.volume_create_delete.VolumeCreateDeleteTest",
- "threads": 4,
- "use_admin": true,
- "use_isolated_tenants": true,
- "kwargs": {}
- }
-]
diff --git a/tempest/stress/stressaction.py b/tempest/stress/stressaction.py
deleted file mode 100644
index cf0a08a..0000000
--- a/tempest/stress/stressaction.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
-#
-# 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 abc
-import signal
-import sys
-
-import six
-
-from oslo_log import log as logging
-
-
-@six.add_metaclass(abc.ABCMeta)
-class StressAction(object):
-
- def __init__(self, manager, max_runs=None, stop_on_error=False):
- full_cname = self.__module__ + "." + self.__class__.__name__
- self.logger = logging.getLogger(full_cname)
- self.manager = manager
- self.max_runs = max_runs
- self.stop_on_error = stop_on_error
-
- def _shutdown_handler(self, signal, frame):
- try:
- self.tearDown()
- except Exception:
- self.logger.exception("Error while tearDown")
- sys.exit(0)
-
- @property
- def action(self):
- """This methods returns the action.
-
- Overload this if you create a stress test wrapper.
- """
- return self.__class__.__name__
-
- def setUp(self, **kwargs):
- """Initialize test structures/resources
-
- This method is called before "run" method to help the test
- initialize any structures. kwargs contains arguments passed
- in from the configuration json file.
-
- setUp doesn't count against the time duration.
- """
- self.logger.debug("setUp")
-
- def tearDown(self):
- """Cleanup test structures/resources
-
- This method is called to do any cleanup after the test is complete.
- """
- self.logger.debug("tearDown")
-
- def execute(self, shared_statistic):
- """This is the main execution entry point called by the driver.
-
- We register a signal handler to allow us to tearDown gracefully,
- and then exit. We also keep track of how many runs we do.
- """
- signal.signal(signal.SIGHUP, self._shutdown_handler)
- signal.signal(signal.SIGTERM, self._shutdown_handler)
-
- while self.max_runs is None or (shared_statistic['runs'] <
- self.max_runs):
- self.logger.debug("Trigger new run (run %d)" %
- shared_statistic['runs'])
- try:
- self.run()
- except Exception:
- shared_statistic['fails'] += 1
- self.logger.exception("Failure in run")
- finally:
- shared_statistic['runs'] += 1
- if self.stop_on_error and (shared_statistic['fails'] > 1):
- self.logger.warning("Stop process due to"
- "\"stop-on-error\" argument")
- self.tearDown()
- sys.exit(1)
-
- @abc.abstractmethod
- def run(self):
- """This method is where the stress test code runs."""
- return
diff --git a/tempest/stress/tools/cleanup.py b/tempest/stress/tools/cleanup.py
deleted file mode 100755
index 3885ba0..0000000
--- a/tempest/stress/tools/cleanup.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2013 Quanta Research Cambridge, Inc.
-#
-# 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.
-
-from tempest.stress import cleanup
-
-cleanup.cleanup()
diff --git a/tempest/test.py b/tempest/test.py
index 6dc065c..cc9410f 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -102,32 +102,6 @@
return decorator
-def stresstest(**kwargs):
- """Add stress test decorator
-
- For all functions with this decorator a attr stress will be
- set automatically.
-
- @param class_setup_per: allowed values are application, process, action
- ``application``: once in the stress job lifetime
- ``process``: once in the worker process lifetime
- ``action``: on each action
- @param allow_inheritance: allows inheritance of this attribute
- """
- def decorator(f):
- if 'class_setup_per' in kwargs:
- setattr(f, "st_class_setup_per", kwargs['class_setup_per'])
- else:
- setattr(f, "st_class_setup_per", 'process')
- if 'allow_inheritance' in kwargs:
- setattr(f, "st_allow_inheritance", kwargs['allow_inheritance'])
- else:
- setattr(f, "st_allow_inheritance", False)
- attr(type='stress')(f)
- return f
- return decorator
-
-
def requires_ext(**kwargs):
"""A decorator to skip tests if an extension is not enabled
diff --git a/tempest/tests/common/test_custom_matchers.py b/tempest/tests/common/test_custom_matchers.py
index 2656a47..07867fc 100644
--- a/tempest/tests/common/test_custom_matchers.py
+++ b/tempest/tests/common/test_custom_matchers.py
@@ -16,11 +16,47 @@
from tempest.common import custom_matchers
from tempest.tests import base
-from testtools.tests.matchers import helpers
+
+# Stolen from testtools/testtools/tests/matchers/helpers.py
+class TestMatchersInterface(object):
+
+ def test_matches_match(self):
+ matcher = self.matches_matcher
+ matches = self.matches_matches
+ mismatches = self.matches_mismatches
+ for candidate in matches:
+ self.assertEqual(None, matcher.match(candidate))
+ for candidate in mismatches:
+ mismatch = matcher.match(candidate)
+ self.assertNotEqual(None, mismatch)
+ self.assertNotEqual(None, getattr(mismatch, 'describe', None))
+
+ def test__str__(self):
+ # [(expected, object to __str__)].
+ from testtools.matchers._doctest import DocTestMatches
+ examples = self.str_examples
+ for expected, matcher in examples:
+ self.assertThat(matcher, DocTestMatches(expected))
+
+ def test_describe_difference(self):
+ # [(expected, matchee, matcher), ...]
+ examples = self.describe_examples
+ for difference, matchee, matcher in examples:
+ mismatch = matcher.match(matchee)
+ self.assertEqual(difference, mismatch.describe())
+
+ def test_mismatch_details(self):
+ # The mismatch object must provide get_details, which must return a
+ # dictionary mapping names to Content objects.
+ examples = self.describe_examples
+ for difference, matchee, matcher in examples:
+ mismatch = matcher.match(matchee)
+ details = mismatch.get_details()
+ self.assertEqual(dict(details), details)
class TestMatchesDictExceptForKeys(base.TestCase,
- helpers.TestMatchersInterface):
+ TestMatchersInterface):
matches_matcher = custom_matchers.MatchesDictExceptForKeys(
{'a': 1, 'b': 2, 'c': 3, 'd': 4}, ['c', 'd'])
diff --git a/tempest/tests/common/utils/test_net_utils.py b/tempest/tests/common/utils/test_net_utils.py
new file mode 100644
index 0000000..83c6bcc
--- /dev/null
+++ b/tempest/tests/common/utils/test_net_utils.py
@@ -0,0 +1,33 @@
+# 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 mock
+
+from tempest.common.utils import net_utils
+from tempest.lib import exceptions as lib_exc
+from tempest.tests import base
+
+
+class TestGetPingPayloadSize(base.TestCase):
+
+ def test_ipv4(self):
+ self.assertEqual(1422, net_utils.get_ping_payload_size(1450, 4))
+
+ def test_ipv6(self):
+ self.assertEqual(1406, net_utils.get_ping_payload_size(1450, 6))
+
+ def test_too_low_mtu(self):
+ self.assertRaises(
+ lib_exc.BadRequest, net_utils.get_ping_payload_size, 10, 4)
+
+ def test_None(self):
+ self.assertIsNone(net_utils.get_ping_payload_size(None, mock.Mock()))
diff --git a/tempest/tests/lib/services/volume/v1/test_quotas_client.py b/tempest/tests/lib/services/volume/v1/test_quotas_client.py
new file mode 100644
index 0000000..f9e76af
--- /dev/null
+++ b/tempest/tests/lib/services/volume/v1/test_quotas_client.py
@@ -0,0 +1,96 @@
+# Copyright 2016 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.
+
+from tempest.lib.services.volume.v1 import quotas_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestQuotasClient(base.BaseServiceTest):
+ FAKE_QUOTAS = {
+ "quota_set": {
+ "cores": 20,
+ "fixed_ips": -1,
+ "floating_ips": 10,
+ "id": "fake_tenant",
+ "injected_file_content_bytes": 10240,
+ "injected_file_path_bytes": 255,
+ "injected_files": 5,
+ "instances": 10,
+ "key_pairs": 100,
+ "metadata_items": 128,
+ "ram": 51200,
+ "security_group_rules": 20,
+ "security_groups": 10
+ }
+ }
+
+ FAKE_UPDATE_QUOTAS_REQUEST = {
+ "quota_set": {
+ "security_groups": 45
+ }
+ }
+
+ def setUp(self):
+ super(TestQuotasClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = quotas_client.QuotasClient(fake_auth,
+ 'volume',
+ 'regionOne')
+
+ def _test_show_default_quota_set(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_default_quota_set,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_QUOTAS,
+ bytes_body, tenant_id="fake_tenant")
+
+ def _test_show_quota_set(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_quota_set,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_QUOTAS,
+ bytes_body, tenant_id="fake_tenant")
+
+ def _test_update_quota_set(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_quota_set,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_UPDATE_QUOTAS_REQUEST,
+ bytes_body, tenant_id="fake_tenant")
+
+ def test_show_default_quota_set_with_str_body(self):
+ self._test_show_default_quota_set()
+
+ def test_show_default_quota_set_with_bytes_body(self):
+ self._test_show_default_quota_set(bytes_body=True)
+
+ def test_show_quota_set_with_str_body(self):
+ self._test_show_quota_set()
+
+ def test_show_quota_set_with_bytes_body(self):
+ self._test_show_quota_set(bytes_body=True)
+
+ def test_update_quota_set_with_str_body(self):
+ self._test_update_quota_set()
+
+ def test_update_quota_set_with_bytes_body(self):
+ self._test_update_quota_set(bytes_body=True)
+
+ def test_delete_quota_set(self):
+ self.check_service_client_function(
+ self.client.delete_quota_set,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ {},
+ tenant_id="fake_tenant")
diff --git a/tempest/tests/lib/services/volume/v1/test_snapshots_client.py b/tempest/tests/lib/services/volume/v1/test_snapshots_client.py
new file mode 100644
index 0000000..49191e3
--- /dev/null
+++ b/tempest/tests/lib/services/volume/v1/test_snapshots_client.py
@@ -0,0 +1,200 @@
+# Copyright 2016 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.
+
+from tempest.lib.services.volume.v1 import snapshots_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestSnapshotsClient(base.BaseServiceTest):
+ FAKE_CREATE_SNAPSHOT = {
+ "snapshot": {
+ "display_name": "snap-001",
+ "display_description": "Daily backup",
+ "volume_id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
+ "force": True
+ }
+ }
+
+ FAKE_UPDATE_SNAPSHOT_REQUEST = {
+ "metadata": {
+ "key": "v1"
+ }
+ }
+
+ FAKE_INFO_SNAPSHOT = {
+ "snapshot": {
+ "id": "3fbbcccf-d058-4502-8844-6feeffdf4cb5",
+ "display_name": "snap-001",
+ "display_description": "Daily backup",
+ "volume_id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
+ "status": "available",
+ "size": 30,
+ "created_at": "2012-02-29T03:50:07Z"
+ }
+ }
+
+ FAKE_LIST_SNAPSHOTS = {
+ "snapshots": [
+ {
+ "id": "3fbbcccf-d058-4502-8844-6feeffdf4cb5",
+ "display_name": "snap-001",
+ "display_description": "Daily backup",
+ "volume_id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
+ "status": "available",
+ "size": 30,
+ "created_at": "2012-02-29T03:50:07Z",
+ "metadata": {
+ "contents": "junk"
+ }
+ },
+ {
+ "id": "e479997c-650b-40a4-9dfe-77655818b0d2",
+ "display_name": "snap-002",
+ "display_description": "Weekly backup",
+ "volume_id": "76b8950a-8594-4e5b-8dce-0dfa9c696358",
+ "status": "available",
+ "size": 25,
+ "created_at": "2012-03-19T01:52:47Z",
+ "metadata": {}
+ }
+ ]
+ }
+
+ def setUp(self):
+ super(TestSnapshotsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = snapshots_client.SnapshotsClient(fake_auth,
+ 'volume',
+ 'regionOne')
+
+ def _test_create_snapshot(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ self.FAKE_CREATE_SNAPSHOT,
+ bytes_body)
+
+ def _test_show_snapshot(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_INFO_SNAPSHOT,
+ bytes_body,
+ snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
+
+ def _test_list_snapshots(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_snapshots,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_LIST_SNAPSHOTS,
+ bytes_body,
+ detail=True)
+
+ def _test_create_snapshot_metadata(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_snapshot_metadata,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ self.FAKE_INFO_SNAPSHOT,
+ bytes_body,
+ snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5",
+ metadata={"key": "v1"})
+
+ def _test_update_snapshot(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_UPDATE_SNAPSHOT_REQUEST,
+ bytes_body,
+ snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
+
+ def _test_show_snapshot_metadata(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_snapshot_metadata,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_UPDATE_SNAPSHOT_REQUEST,
+ bytes_body,
+ snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
+
+ def _test_update_snapshot_metadata(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_snapshot_metadata,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_UPDATE_SNAPSHOT_REQUEST,
+ bytes_body, snapshot_id="cbc36478b0bd8e67e89")
+
+ def _test_update_snapshot_metadata_item(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_snapshot_metadata_item,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_INFO_SNAPSHOT,
+ bytes_body, volume_type_id="cbc36478b0bd8e67e89")
+
+ def test_create_snapshot_with_str_body(self):
+ self._test_create_snapshot()
+
+ def test_create_snapshot_with_bytes_body(self):
+ self._test_create_snapshot(bytes_body=True)
+
+ def test_show_snapshot_with_str_body(self):
+ self._test_show_snapshot()
+
+ def test_show_snapshot_with_bytes_body(self):
+ self._test_show_snapshot(bytes_body=True)
+
+ def test_list_snapshots_with_str_body(self):
+ self._test_list_snapshots()
+
+ def test_list_snapshots_with_bytes_body(self):
+ self._test_list_snapshots(bytes_body=True)
+
+ def test_create_snapshot_metadata_with_str_body(self):
+ self._test_create_snapshot_metadata()
+
+ def test_create_snapshot_metadata_with_bytes_body(self):
+ self._test_create_snapshot_metadata(bytes_body=True)
+
+ def test_update_snapshot_with_str_body(self):
+ self._test_update_snapshot()
+
+ def test_update_snapshot_with_bytes_body(self):
+ self._test_update_snapshot(bytes_body=True)
+
+ def test_show_snapshot_metadata_with_str_body(self):
+ self._test_show_snapshot_metadata()
+
+ def test_show_snapshot_metadata_with_bytes_body(self):
+ self._test_show_snapshot_metadata(bytes_body=True)
+
+ def test_update_snapshot_metadata_with_str_body(self):
+ self._test_update_snapshot_metadata()
+
+ def test_update_snapshot_metadata_with_bytes_body(self):
+ self._test_update_snapshot_metadata(bytes_body=True)
+
+ def test_force_delete_snapshot(self):
+ self.check_service_client_function(
+ self.client.force_delete_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ {},
+ snapshot_id="521752a6-acf6-4b2d-bc7a-119f9148cd8c",
+ status=202)
+
+ def test_delete_snapshot(self):
+ self.check_service_client_function(
+ self.client.delete_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ {},
+ snapshot_id="521752a6-acf6-4b2d-bc7a-119f9148cd8c",
+ status=202)
diff --git a/tempest/tests/lib/services/volume/v2/test_quotas_client.py b/tempest/tests/lib/services/volume/v2/test_quotas_client.py
new file mode 100644
index 0000000..6384350
--- /dev/null
+++ b/tempest/tests/lib/services/volume/v2/test_quotas_client.py
@@ -0,0 +1,86 @@
+# Copyright 2016 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.
+
+from tempest.lib.services.volume.v2 import quotas_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestQuotasClient(base.BaseServiceTest):
+ FAKE_QUOTAS = {
+ "quota_set": {
+ "gigabytes": 5,
+ "snapshots": 10,
+ "volumes": 20
+ }
+ }
+
+ FAKE_UPDATE_QUOTAS_REQUEST = {
+ "quota_set": {
+ "security_groups": 45
+ }
+ }
+
+ def setUp(self):
+ super(TestQuotasClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = quotas_client.QuotasClient(fake_auth,
+ 'volume',
+ 'regionOne')
+
+ def _test_show_default_quota_set(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_default_quota_set,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_QUOTAS,
+ bytes_body, tenant_id="fake_tenant")
+
+ def _test_show_quota_set(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_quota_set,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_QUOTAS,
+ bytes_body, tenant_id="fake_tenant")
+
+ def _test_update_quota_set(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_quota_set,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_UPDATE_QUOTAS_REQUEST,
+ bytes_body, tenant_id="fake_tenant")
+
+ def test_show_default_quota_set_with_str_body(self):
+ self._test_show_default_quota_set()
+
+ def test_show_default_quota_set_with_bytes_body(self):
+ self._test_show_default_quota_set(bytes_body=True)
+
+ def test_show_quota_set_with_str_body(self):
+ self._test_show_quota_set()
+
+ def test_show_quota_set_with_bytes_body(self):
+ self._test_show_quota_set(bytes_body=True)
+
+ def test_update_quota_set_with_str_body(self):
+ self._test_update_quota_set()
+
+ def test_update_quota_set_with_bytes_body(self):
+ self._test_update_quota_set(bytes_body=True)
+
+ def test_delete_quota_set(self):
+ self.check_service_client_function(
+ self.client.delete_quota_set,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ {},
+ tenant_id="fake_tenant")
diff --git a/tempest/tests/lib/services/volume/v2/test_snapshots_client.py b/tempest/tests/lib/services/volume/v2/test_snapshots_client.py
new file mode 100644
index 0000000..7d656f1
--- /dev/null
+++ b/tempest/tests/lib/services/volume/v2/test_snapshots_client.py
@@ -0,0 +1,201 @@
+# Copyright 2016 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.
+
+from tempest.lib.services.volume.v2 import snapshots_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestSnapshotsClient(base.BaseServiceTest):
+ FAKE_CREATE_SNAPSHOT = {
+ "snapshot": {
+ "display_name": "snap-001",
+ "display_description": "Daily backup",
+ "volume_id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
+ "force": True
+ }
+ }
+
+ FAKE_UPDATE_SNAPSHOT_REQUEST = {
+ "metadata": {
+ "key": "v1"
+ }
+ }
+
+ FAKE_INFO_SNAPSHOT = {
+ "snapshot": {
+ "id": "3fbbcccf-d058-4502-8844-6feeffdf4cb5",
+ "display_name": "snap-001",
+ "display_description": "Daily backup",
+ "volume_id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
+ "status": "available",
+ "size": 30,
+ "created_at": "2012-02-29T03:50:07Z"
+ }
+ }
+
+ FAKE_LIST_SNAPSHOTS = {
+ "snapshots": [
+ {
+ "id": "3fbbcccf-d058-4502-8844-6feeffdf4cb5",
+ "display_name": "snap-001",
+ "display_description": "Daily backup",
+ "volume_id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
+ "status": "available",
+ "size": 30,
+ "created_at": "2012-02-29T03:50:07Z",
+ "metadata": {
+ "contents": "junk"
+ }
+ },
+ {
+ "id": "e479997c-650b-40a4-9dfe-77655818b0d2",
+ "display_name": "snap-002",
+ "display_description": "Weekly backup",
+ "volume_id": "76b8950a-8594-4e5b-8dce-0dfa9c696358",
+ "status": "available",
+ "size": 25,
+ "created_at": "2012-03-19T01:52:47Z",
+ "metadata": {}
+ }
+ ]
+ }
+
+ def setUp(self):
+ super(TestSnapshotsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = snapshots_client.SnapshotsClient(fake_auth,
+ 'volume',
+ 'regionOne')
+
+ def _test_create_snapshot(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ self.FAKE_CREATE_SNAPSHOT,
+ bytes_body,
+ status=202)
+
+ def _test_show_snapshot(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_INFO_SNAPSHOT,
+ bytes_body,
+ snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
+
+ def _test_list_snapshots(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_snapshots,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_LIST_SNAPSHOTS,
+ bytes_body,
+ detail=True)
+
+ def _test_create_snapshot_metadata(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_snapshot_metadata,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ self.FAKE_INFO_SNAPSHOT,
+ bytes_body,
+ snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5",
+ metadata={"key": "v1"})
+
+ def _test_update_snapshot(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_UPDATE_SNAPSHOT_REQUEST,
+ bytes_body,
+ snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
+
+ def _test_show_snapshot_metadata(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_snapshot_metadata,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_UPDATE_SNAPSHOT_REQUEST,
+ bytes_body,
+ snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
+
+ def _test_update_snapshot_metadata(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_snapshot_metadata,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_UPDATE_SNAPSHOT_REQUEST,
+ bytes_body, snapshot_id="cbc36478b0bd8e67e89")
+
+ def _test_update_snapshot_metadata_item(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_snapshot_metadata_item,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_INFO_SNAPSHOT,
+ bytes_body, volume_type_id="cbc36478b0bd8e67e89")
+
+ def test_create_snapshot_with_str_body(self):
+ self._test_create_snapshot()
+
+ def test_create_snapshot_with_bytes_body(self):
+ self._test_create_snapshot(bytes_body=True)
+
+ def test_show_snapshot_with_str_body(self):
+ self._test_show_snapshot()
+
+ def test_show_snapshot_with_bytes_body(self):
+ self._test_show_snapshot(bytes_body=True)
+
+ def test_list_snapshots_with_str_body(self):
+ self._test_list_snapshots()
+
+ def test_list_snapshots_with_bytes_body(self):
+ self._test_list_snapshots(bytes_body=True)
+
+ def test_create_snapshot_metadata_with_str_body(self):
+ self._test_create_snapshot_metadata()
+
+ def test_create_snapshot_metadata_with_bytes_body(self):
+ self._test_create_snapshot_metadata(bytes_body=True)
+
+ def test_update_snapshot_with_str_body(self):
+ self._test_update_snapshot()
+
+ def test_update_snapshot_with_bytes_body(self):
+ self._test_update_snapshot(bytes_body=True)
+
+ def test_show_snapshot_metadata_with_str_body(self):
+ self._test_show_snapshot_metadata()
+
+ def test_show_snapshot_metadata_with_bytes_body(self):
+ self._test_show_snapshot_metadata(bytes_body=True)
+
+ def test_update_snapshot_metadata_with_str_body(self):
+ self._test_update_snapshot_metadata()
+
+ def test_update_snapshot_metadata_with_bytes_body(self):
+ self._test_update_snapshot_metadata(bytes_body=True)
+
+ def test_force_delete_snapshot(self):
+ self.check_service_client_function(
+ self.client.force_delete_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ {},
+ snapshot_id="521752a6-acf6-4b2d-bc7a-119f9148cd8c",
+ status=202)
+
+ def test_delete_snapshot(self):
+ self.check_service_client_function(
+ self.client.delete_snapshot,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ {},
+ snapshot_id="521752a6-acf6-4b2d-bc7a-119f9148cd8c",
+ status=202)
diff --git a/tempest/tests/lib/test_rest_client.py b/tempest/tests/lib/test_rest_client.py
index 057f57b..e6cf047 100644
--- a/tempest/tests/lib/test_rest_client.py
+++ b/tempest/tests/lib/test_rest_client.py
@@ -296,10 +296,6 @@
status=int(r_code),
body=json.dumps(resp_body))
data = {
- "method": "fake_method",
- "url": "fake_url",
- "headers": "fake_headers",
- "body": "fake_body",
"resp": resp,
"resp_body": json.dumps(resp_body)
}
diff --git a/tempest/tests/stress/__init__.py b/tempest/tests/stress/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/tests/stress/__init__.py
+++ /dev/null
diff --git a/tempest/tests/stress/test_stress.py b/tempest/tests/stress/test_stress.py
deleted file mode 100644
index dfe0291..0000000
--- a/tempest/tests/stress/test_stress.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright 2013 Deutsche Telekom AG
-# 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 shlex
-import subprocess
-
-from oslo_log import log as logging
-from tempest.lib import exceptions
-from tempest.tests import base
-
-LOG = logging.getLogger(__name__)
-
-
-class StressFrameworkTest(base.TestCase):
- """Basic test for the stress test framework."""
-
- def _cmd(self, cmd, param):
- """Executes specified command."""
- cmd = ' '.join([cmd, param])
- LOG.info("running: '%s'" % cmd)
- cmd_str = cmd
- cmd = shlex.split(cmd)
- result = ''
- result_err = ''
- try:
- stdout = subprocess.PIPE
- stderr = subprocess.PIPE
- proc = subprocess.Popen(
- cmd, stdout=stdout, stderr=stderr)
- result, result_err = proc.communicate()
- if proc.returncode != 0:
- LOG.debug('error of %s:\n%s' % (cmd_str, result_err))
- raise exceptions.CommandFailed(proc.returncode,
- cmd,
- result)
- finally:
- LOG.debug('output of %s:\n%s' % (cmd_str, result))
- return proc.returncode
-
- def test_help_function(self):
- result = self._cmd("python", "-m tempest.cmd.run_stress -h")
- self.assertEqual(0, result)
diff --git a/tempest/tests/stress/test_stressaction.py b/tempest/tests/stress/test_stressaction.py
deleted file mode 100644
index 1a1bb67..0000000
--- a/tempest/tests/stress/test_stressaction.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright 2013 Deutsche Telekom AG
-# 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 tempest.stress.stressaction as stressaction
-import tempest.test
-
-
-class FakeStressAction(stressaction.StressAction):
- def __init__(self, manager, max_runs=None, stop_on_error=False):
- super(self.__class__, self).__init__(manager, max_runs, stop_on_error)
- self._run_called = False
-
- def run(self):
- self._run_called = True
-
- @property
- def run_called(self):
- return self._run_called
-
-
-class FakeStressActionFailing(stressaction.StressAction):
- def run(self):
- raise Exception('FakeStressActionFailing raise exception')
-
-
-class TestStressAction(tempest.test.BaseTestCase):
- def _bulid_stats_dict(self, runs=0, fails=0):
- return {'runs': runs, 'fails': fails}
-
- def testStressTestRun(self):
- stressAction = FakeStressAction(manager=None, max_runs=1)
- stats = self._bulid_stats_dict()
- stressAction.execute(stats)
- self.assertTrue(stressAction.run_called)
- self.assertEqual(stats['runs'], 1)
- self.assertEqual(stats['fails'], 0)
-
- def testStressMaxTestRuns(self):
- stressAction = FakeStressAction(manager=None, max_runs=500)
- stats = self._bulid_stats_dict(runs=499)
- stressAction.execute(stats)
- self.assertTrue(stressAction.run_called)
- self.assertEqual(stats['runs'], 500)
- self.assertEqual(stats['fails'], 0)
-
- def testStressTestRunWithException(self):
- stressAction = FakeStressActionFailing(manager=None, max_runs=1)
- stats = self._bulid_stats_dict()
- stressAction.execute(stats)
- self.assertEqual(stats['runs'], 1)
- self.assertEqual(stats['fails'], 1)
diff --git a/tempest/tests/test_decorators.py b/tempest/tests/test_decorators.py
index 17dbea0..ae2f2a3 100644
--- a/tempest/tests/test_decorators.py
+++ b/tempest/tests/test_decorators.py
@@ -153,36 +153,6 @@
continue
-class TestStressDecorator(BaseDecoratorsTest):
- def _test_stresstest_helper(self, expected_frequency='process',
- expected_inheritance=False,
- **decorator_args):
- @test.stresstest(**decorator_args)
- def foo():
- pass
- self.assertEqual(getattr(foo, 'st_class_setup_per'),
- expected_frequency)
- self.assertEqual(getattr(foo, 'st_allow_inheritance'),
- expected_inheritance)
- self.assertEqual(set(['stress']), getattr(foo, '__testtools_attrs'))
-
- def test_stresstest_decorator_default(self):
- self._test_stresstest_helper()
-
- def test_stresstest_decorator_class_setup_frequency(self):
- self._test_stresstest_helper('process', class_setup_per='process')
-
- def test_stresstest_decorator_class_setup_frequency_non_default(self):
- self._test_stresstest_helper(expected_frequency='application',
- class_setup_per='application')
-
- def test_stresstest_decorator_set_frequency_and_inheritance(self):
- self._test_stresstest_helper(expected_frequency='application',
- expected_inheritance=True,
- class_setup_per='application',
- allow_inheritance=True)
-
-
class TestRequiresExtDecorator(BaseDecoratorsTest):
def setUp(self):
super(TestRequiresExtDecorator, self).setUp()
diff --git a/tox.ini b/tox.ini
index 02eef78..82dba92 100644
--- a/tox.ini
+++ b/tox.ini
@@ -112,14 +112,6 @@
find . -type f -name "*.pyc" -delete
tempest run --serial --regex '\[.*\bsmoke\b.*\]' {posargs}
-[testenv:stress]
-envdir = .tox/tempest
-sitepackages = {[tempestenv]sitepackages}
-setenv = {[tempestenv]setenv}
-deps = {[tempestenv]deps}
-commands =
- run-tempest-stress {posargs}
-
[testenv:venv]
commands = {posargs}