Merge "Add argument to stop stress test on first error"
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 13c2f74..b35b1b2 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -110,6 +110,11 @@
self.assertEqual(202, resp.status)
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+ def _unpause(self, server_id):
+ resp, body = self.servers_client.unpause_server(server_id)
+ self.assertEqual(202, resp.status)
+ self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
+
@attr(type='smoke')
def test_rescue_unrescue_instance(self):
resp, body = self.servers_client.rescue_server(
@@ -121,6 +126,18 @@
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
@attr(type=['negative', 'gate'])
+ def test_rescue_paused_instance(self):
+ #Rescue a paused server
+ resp, body = self.servers_client.pause_server(
+ self.server_id)
+ self.addCleanup(self._unpause, self.server_id)
+ self.assertEqual(202, resp.status)
+ self.servers_client.wait_for_server_status(self.server_id, 'PAUSED')
+ self.assertRaises(exceptions.Duplicate,
+ self.servers_client.rescue_server,
+ self.server_id)
+
+ @attr(type=['negative', 'gate'])
def test_rescued_vm_reboot(self):
self.assertRaises(exceptions.Duplicate, self.servers_client.reboot,
self.rescue_id, 'HARD')
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
new file mode 100644
index 0000000..a7b872f
--- /dev/null
+++ b/tempest/stress/actions/volume_attach_delete.py
@@ -0,0 +1,70 @@
+# (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.data_utils import rand_name
+import tempest.stress.stressaction as stressaction
+
+
+class VolumeAttachDeleteTest(stressaction.StressAction):
+
+ def setUp(self, **kwargs):
+ self.image = self.manager.config.compute.image_ref
+ self.flavor = self.manager.config.compute.flavor_ref
+
+ def run(self):
+ # Step 1: create volume
+ name = rand_name("volume")
+ self.logger.info("creating volume: %s" % name)
+ resp, volume = self.manager.volumes_client.create_volume(size=1,
+ display_name=
+ name)
+ assert(resp.status == 200)
+ 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 = rand_name("instance")
+ self.logger.info("creating vm: %s" % vm_name)
+ resp, server = self.manager.servers_client.create_server(
+ vm_name, self.image, self.flavor)
+ server_id = server['id']
+ assert(resp.status == 202)
+ self.manager.servers_client.wait_for_server_status(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))
+ resp, body = self.manager.servers_client.attach_volume(server_id,
+ volume['id'],
+ '/dev/vdc')
+ assert(resp.status == 200)
+ 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)
+ resp, _ = self.manager.servers_client.delete_server(server_id)
+ assert(resp.status == 204)
+ self.manager.servers_client.wait_for_server_termination(server_id)
+ self.logger.info("deleted vm: %s" % server_id)
+
+ # Step 5: delete volume
+ self.logger.info("deleting volume: %s" % volume['id'])
+ resp, _ = self.manager.volumes_client.delete_volume(volume['id'])
+ assert(resp.status == 202)
+ self.manager.volumes_client.wait_for_resource_deletion(volume['id'])
+ self.logger.info("deleted volume: %s" % volume['id'])
diff --git a/tempest/stress/etc/stress-tox-job.json b/tempest/stress/etc/stress-tox-job.json
index 159794b..3534c26 100644
--- a/tempest/stress/etc/stress-tox-job.json
+++ b/tempest/stress/etc/stress-tox-job.json
@@ -9,5 +9,11 @@
"use_admin": false,
"use_isolated_tenants": false,
"kwargs": {}
+ },
+ {"action": "tempest.stress.actions.volume_attach_delete.VolumeAttachDeleteTest",
+ "threads": 2,
+ "use_admin": false,
+ "use_isolated_tenants": false,
+ "kwargs": {}
}
]
diff --git a/tempest/stress/etc/volume-assign-delete-test.json b/tempest/stress/etc/volume-assign-delete-test.json
new file mode 100644
index 0000000..4553ff8
--- /dev/null
+++ b/tempest/stress/etc/volume-assign-delete-test.json
@@ -0,0 +1,7 @@
+[{"action": "tempest.stress.actions.volume_attach_delete.VolumeAttachDeleteTest",
+ "threads": 4,
+ "use_admin": false,
+ "use_isolated_tenants": false,
+ "kwargs": {}
+ }
+]
diff --git a/tools/pretty_tox_serial.sh b/tools/pretty_tox_serial.sh
new file mode 100755
index 0000000..490d263
--- /dev/null
+++ b/tools/pretty_tox_serial.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+TESTRARGS=$@
+
+if [ ! -d .testrepository ]; then
+ testr init
+fi
+testr run --subunit $TESTRARGS | subunit-2to1 | tools/colorizer.py
+testr slowest
diff --git a/tox.ini b/tox.ini
index 93a53ac..7eae948 100644
--- a/tox.ini
+++ b/tox.ini
@@ -26,6 +26,12 @@
commands =
nosetests --logging-format '%(asctime)-15s %(message)s' --with-xunit --xunit-file=nosetests-full.xml -sv tempest/api tempest/scenario tempest/thirdparty tempest/cli
+[testenv:testr-serial]
+sitepackages = True
+setenv = VIRTUAL_ENV={envdir}
+commands =
+ sh tools/pretty_tox_serial.sh '{posargs} tempest.api tempest.scenario tempest.thirdparty tempest.cli'
+
[testenv:testr-full]
sitepackages = True
setenv = VIRTUAL_ENV={envdir}