Merge "Check server terminations on "delete server" tests"
diff --git a/HACKING.rst b/HACKING.rst
index e7e7651..c0df0fb 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -108,16 +108,36 @@
Negative Tests
--------------
-When adding negative tests to tempest there are 2 requirements. First the tests
-must be marked with a negative attribute. For example::
+Newly added negative tests should use the negative test framework. First step
+is to create an interface description in a json file under `etc/schemas`.
+These descriptions consists of two important sections for the test
+(one of those is mandatory):
- @attr(type=negative)
- def test_resource_no_uuid(self):
- ...
+ - A resource (part of the URL of the request): Resources needed for a test
+ must be created in `setUpClass` and registered with `set_resource` e.g.:
+ `cls.set_resource("server", server['id'])`
-The second requirement is that all negative tests must be added to a negative
-test file. If such a file doesn't exist for the particular resource being
-tested a new test file should be added.
+ - A json schema: defines properties for a request.
+
+After that a test class must be added to automatically generate test scenarios
+out of the given interface description:
+
+ class SampeTestNegativeTestJSON(<your base class>, test.NegativeAutoTest):
+ _interface = 'json'
+ _service = 'compute'
+ _schema_file = 'compute/servers/get_console_output.json'
+ scenarios = test.NegativeAutoTest.generate_scenario(_schema_file)
+
+Negative tests must be marked with a negative attribute::
+
+ @test.attr(type=['negative', 'gate'])
+ def test_get_console_output(self):
+ self.execute(self._schema_file)
+
+All negative tests should be added into a separate negative test file.
+If such a file doesn't exist for the particular resource being tested a new
+test file should be added. Old XML based negative tests can be kept but should
+be renamed to `_xml.py`.
Test skips because of Known Bugs
--------------------------------
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index a2d3877..95a4884 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -105,6 +105,10 @@
# value)
#catalog_type=baremetal
+# The endpoint type to use for the baremetal provisioning
+# service. (string value)
+#endpoint_type=publicURL
+
[boto]
@@ -165,6 +169,11 @@
# value)
#cli_dir=/usr/local/bin
+# Whether the tempest run location has access to the *-manage
+# commands. In a pure blackbox environment it will not.
+# (boolean value)
+#has_manage=true
+
# Number of seconds to wait on a CLI timeout (integer value)
#timeout=15
@@ -320,6 +329,10 @@
# If false, skip disk config tests (boolean value)
#disk_config=true
+# A list of enabled compute extensions with a special entry
+# all which indicates every extension is enabled (list value)
+#api_extensions=all
+
# A list of enabled v3 extensions with a special entry all
# which indicates every extension is enabled (list value)
#api_v3_extensions=all
@@ -369,6 +382,10 @@
# Catalog type of the data processing service. (string value)
#catalog_type=data_processing
+# The endpoint type to use for the data processing service.
+# (string value)
+#endpoint_type=publicURL
+
[debug]
@@ -582,16 +599,8 @@
# Options defined in tempest.config
#
-# A list of enabled extensions with a special entry all which
-# indicates every extension is enabled (list value)
-#api_extensions=all
-
-# A list of enabled extensions with a special entry all which
-# indicates every extension is enabled (list value)
-#api_extensions=all
-
-# A list of enabled extensions with a special entry all which
-# indicates every extension is enabled (list value)
+# A list of enabled network extensions with a special entry
+# all which indicates every extension is enabled (list value)
#api_extensions=all
@@ -815,6 +824,10 @@
# Catalog type of the Telemetry service. (string value)
#catalog_type=metering
+# The endpoint type to use for the telemetry service. (string
+# value)
+#endpoint_type=publicURL
+
[volume]
@@ -877,6 +890,10 @@
# Runs Cinder volumes backup test (boolean value)
#backup=true
+# A list of enabled volume extensions with a special entry all
+# which indicates every extension is enabled (list value)
+#api_extensions=all
+
# Is the v1 volume API enabled (boolean value)
#api_v1=true
diff --git a/requirements.txt b/requirements.txt
index 8573a2e..a08a437 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,5 @@
pbr>=0.5.21,<1.0
anyjson>=0.3.3
-nose
httplib2>=0.7.5
jsonschema>=2.0.0,<3.0.0
testtools>=0.9.34
diff --git a/run_tempest.sh b/run_tempest.sh
index f6c330d..bdd1f69 100755
--- a/run_tempest.sh
+++ b/run_tempest.sh
@@ -53,12 +53,12 @@
-u|--update) update=1;;
-d|--debug) debug=1;;
-C|--config) config_file=$2; shift;;
- -s|--smoke) testrargs+="smoke"; noseargs+="--attr=type=smoke";;
+ -s|--smoke) testrargs+="smoke";;
-t|--serial) serial=1;;
-l|--logging) logging=1;;
-L|--logging-config) logging_config=$2; shift;;
--) [ "yes" == "$first_uu" ] || testrargs="$testrargs $1"; first_uu=no ;;
- *) testrargs="$testrargs $1"; noseargs+=" $1" ;;
+ *) testrargs+="$testrargs $1";;
esac
shift
done
@@ -110,22 +110,6 @@
fi
}
-function run_tests_nose {
- export NOSE_WITH_OPENSTACK=1
- export NOSE_OPENSTACK_COLOR=1
- export NOSE_OPENSTACK_RED=15.00
- export NOSE_OPENSTACK_YELLOW=3.00
- export NOSE_OPENSTACK_SHOW_ELAPSED=1
- export NOSE_OPENSTACK_STDOUT=1
- export TEMPEST_PY26_NOSE_COMPAT=1
- if [[ "x$noseargs" =~ "tempest" ]]; then
- noseargs="$testrargs"
- else
- noseargs="$noseargs tempest"
- fi
- ${wrapper} nosetests $noseargs
-}
-
if [ $never_venv -eq 0 ]
then
# Remove the virtual environment if --force used
@@ -156,12 +140,7 @@
fi
fi
-py_version=`${wrapper} python --version 2>&1`
-if [[ $py_version =~ "2.6" ]] ; then
- run_tests_nose
-else
- run_tests
-fi
+run_tests
retval=$?
exit $retval
diff --git a/run_tests.sh b/run_tests.sh
index cb6a5df..a12bf46 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -54,7 +54,7 @@
-c|--coverage) coverage=1;;
-t|--serial) serial=1;;
--) [ "yes" == "$first_uu" ] || testrargs="$testrargs $1"; first_uu=no ;;
- *) testrargs="$testrargs $1"; noseargs+=" $1" ;;
+ *) testrargs="$testrargs $1";;
esac
shift
done
@@ -84,6 +84,11 @@
return $?
fi
+ if [ $coverage -eq 1 ]; then
+ ${wrapper} python setup.py test --coverage
+ return $?
+ fi
+
if [ $serial -eq 1 ]; then
${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py
else
@@ -137,10 +142,6 @@
exit
fi
-if [ $coverage -eq 1 ]; then
- $testrargs = "--coverage $testrargs"
-fi
-
run_tests
retval=$?
diff --git a/setup.cfg b/setup.cfg
index 79f538f..a701572 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,8 +4,8 @@
summary = OpenStack Integration Testing
description-file =
README.rst
-author = OpenStack QA
-author-email = openstack-qa@lists.openstack.org
+author = OpenStack
+author-email = openstack-dev@lists.openstack.org
home-page = http://www.openstack.org/
classifier =
Intended Audience :: Information Technology
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 72bb723..9162926 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -303,6 +303,8 @@
class BaseV3ComputeTest(BaseComputeTest):
+ _interface = "json"
+
@classmethod
def setUpClass(cls):
# By default compute tests do not create network resources
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 0bf604c..826317d 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -15,8 +15,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
-from tempest.test import attr
+from tempest import test
class ServerRescueTestJSON(base.BaseV2ComputeTest):
@@ -26,7 +25,6 @@
def setUpClass(cls):
cls.set_network_resources(network=True, subnet=True, router=True)
super(ServerRescueTestJSON, cls).setUpClass()
- cls.device = 'vdf'
# Floating IP creation
resp, body = cls.floating_ips_client.create_floating_ip()
@@ -54,14 +52,6 @@
cls.password = server['adminPass']
cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE')
- # Server for negative tests
- cls.rescue_id = resc_server['id']
- cls.rescue_password = resc_server['adminPass']
-
- cls.servers_client.rescue_server(
- cls.rescue_id, adminPass=cls.rescue_password)
- cls.servers_client.wait_for_server_status(cls.rescue_id, 'RESCUE')
-
def setUp(self):
super(ServerRescueTestJSON, self).setUp()
@@ -77,22 +67,12 @@
def tearDown(self):
super(ServerRescueTestJSON, self).tearDown()
- def _detach(self, server_id, volume_id):
- self.servers_client.detach_volume(server_id, volume_id)
- self.volumes_extensions_client.wait_for_volume_status(volume_id,
- 'available')
-
def _unrescue(self, server_id):
resp, body = self.servers_client.unrescue_server(server_id)
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')
+ @test.attr(type='smoke')
def test_rescue_unrescue_instance(self):
resp, body = self.servers_client.rescue_server(
self.server_id, adminPass=self.password)
@@ -102,76 +82,7 @@
self.assertEqual(202, resp.status)
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.Conflict,
- self.servers_client.rescue_server,
- self.server_id)
-
- @attr(type=['negative', 'gate'])
- def test_rescued_vm_reboot(self):
- self.assertRaises(exceptions.Conflict, self.servers_client.reboot,
- self.rescue_id, 'HARD')
-
- @attr(type=['negative', 'gate'])
- def test_rescue_non_existent_server(self):
- # Rescue a non-existing server
- self.assertRaises(exceptions.NotFound,
- self.servers_client.rescue_server,
- '999erra43')
-
- @attr(type=['negative', 'gate'])
- def test_rescued_vm_rebuild(self):
- self.assertRaises(exceptions.Conflict,
- self.servers_client.rebuild,
- self.rescue_id,
- self.image_ref_alt)
-
- @attr(type=['negative', 'gate'])
- def test_rescued_vm_attach_volume(self):
- # Rescue the server
- self.servers_client.rescue_server(self.server_id,
- adminPass=self.password)
- self.servers_client.wait_for_server_status(self.server_id, 'RESCUE')
- self.addCleanup(self._unrescue, self.server_id)
-
- # Attach the volume to the server
- self.assertRaises(exceptions.Conflict,
- self.servers_client.attach_volume,
- self.server_id,
- self.volume['id'],
- device='/dev/%s' % self.device)
-
- @attr(type=['negative', 'gate'])
- def test_rescued_vm_detach_volume(self):
- # Attach the volume to the server
- self.servers_client.attach_volume(self.server_id,
- self.volume['id'],
- device='/dev/%s' % self.device)
- self.volumes_extensions_client.wait_for_volume_status(
- self.volume['id'], 'in-use')
-
- # Rescue the server
- self.servers_client.rescue_server(self.server_id,
- adminPass=self.password)
- self.servers_client.wait_for_server_status(self.server_id, 'RESCUE')
- # addCleanup is a LIFO queue
- self.addCleanup(self._detach, self.server_id, self.volume['id'])
- self.addCleanup(self._unrescue, self.server_id)
-
- # Detach the volume from the server expecting failure
- self.assertRaises(exceptions.Conflict,
- self.servers_client.detach_volume,
- self.server_id,
- self.volume['id'])
-
- @attr(type='gate')
+ @test.attr(type='gate')
def test_rescued_vm_associate_dissociate_floating_ip(self):
# Rescue the server
self.servers_client.rescue_server(
@@ -191,7 +102,7 @@
self.server_id)
self.assertEqual(202, resp.status)
- @attr(type='gate')
+ @test.attr(type='gate')
def test_rescued_vm_add_remove_security_group(self):
# Rescue the server
self.servers_client.rescue_server(
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
new file mode 100644
index 0000000..ffd79fa
--- /dev/null
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -0,0 +1,135 @@
+# Copyright 2013 Hewlett-Packard Development Company, L.P.
+# Copyright 2014 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.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest import test
+
+
+class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ cls.set_network_resources(network=True, subnet=True, router=True)
+ super(ServerRescueNegativeTestJSON, cls).setUpClass()
+ cls.device = 'vdf'
+
+ # Create a volume and wait for it to become ready for attach
+ resp, cls.volume = cls.volumes_extensions_client.create_volume(
+ 1, display_name=data_utils.rand_name(cls.__name__ + '_volume'))
+ cls.volumes_extensions_client.wait_for_volume_status(
+ cls.volume['id'], 'available')
+
+ # Server for negative tests
+ resp, server = cls.create_test_server(wait_until='BUILD')
+ resp, resc_server = cls.create_test_server(wait_until='ACTIVE')
+ cls.server_id = server['id']
+ cls.password = server['adminPass']
+ cls.rescue_id = resc_server['id']
+ rescue_password = resc_server['adminPass']
+
+ cls.servers_client.rescue_server(
+ cls.rescue_id, adminPass=rescue_password)
+ cls.servers_client.wait_for_server_status(cls.rescue_id, 'RESCUE')
+
+ def _detach(self, server_id, volume_id):
+ self.servers_client.detach_volume(server_id, volume_id)
+ self.volumes_extensions_client.wait_for_volume_status(volume_id,
+ 'available')
+
+ def _unrescue(self, server_id):
+ resp, body = self.servers_client.unrescue_server(server_id)
+ 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')
+
+ @test.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.Conflict,
+ self.servers_client.rescue_server,
+ self.server_id)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_rescued_vm_reboot(self):
+ self.assertRaises(exceptions.Conflict, self.servers_client.reboot,
+ self.rescue_id, 'HARD')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_rescue_non_existent_server(self):
+ # Rescue a non-existing server
+ non_existent_server = data_utils.rand_uuid()
+ self.assertRaises(exceptions.NotFound,
+ self.servers_client.rescue_server,
+ non_existent_server)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_rescued_vm_rebuild(self):
+ self.assertRaises(exceptions.Conflict,
+ self.servers_client.rebuild,
+ self.rescue_id,
+ self.image_ref_alt)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_rescued_vm_attach_volume(self):
+ # Rescue the server
+ self.servers_client.rescue_server(self.server_id,
+ adminPass=self.password)
+ self.servers_client.wait_for_server_status(self.server_id, 'RESCUE')
+ self.addCleanup(self._unrescue, self.server_id)
+
+ # Attach the volume to the server
+ self.assertRaises(exceptions.Conflict,
+ self.servers_client.attach_volume,
+ self.server_id,
+ self.volume['id'],
+ device='/dev/%s' % self.device)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_rescued_vm_detach_volume(self):
+ # Attach the volume to the server
+ self.servers_client.attach_volume(self.server_id,
+ self.volume['id'],
+ device='/dev/%s' % self.device)
+ self.volumes_extensions_client.wait_for_volume_status(
+ self.volume['id'], 'in-use')
+
+ # Rescue the server
+ self.servers_client.rescue_server(self.server_id,
+ adminPass=self.password)
+ self.servers_client.wait_for_server_status(self.server_id, 'RESCUE')
+ # addCleanup is a LIFO queue
+ self.addCleanup(self._detach, self.server_id, self.volume['id'])
+ self.addCleanup(self._unrescue, self.server_id)
+
+ # Detach the volume from the server expecting failure
+ self.assertRaises(exceptions.Conflict,
+ self.servers_client.detach_volume,
+ self.server_id,
+ self.volume['id'])
+
+
+class ServerRescueNegativeTestXML(ServerRescueNegativeTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/compute/test_live_block_migration_negative.py b/tempest/api/compute/test_live_block_migration_negative.py
index da0e4c4..e1a264e 100644
--- a/tempest/api/compute/test_live_block_migration_negative.py
+++ b/tempest/api/compute/test_live_block_migration_negative.py
@@ -38,7 +38,7 @@
def _migrate_server_to(self, server_id, dest_host):
_resp, body = self.admin_servers_client.live_migrate_server(
server_id, dest_host,
- self.config.compute_feature_enabled.
+ CONF.compute_feature_enabled.
block_migration_for_live_migration)
return body
diff --git a/tempest/api/compute/v3/admin/test_aggregates.py b/tempest/api/compute/v3/admin/test_aggregates.py
index 20093e4..a00a5b5 100644
--- a/tempest/api/compute/v3/admin/test_aggregates.py
+++ b/tempest/api/compute/v3/admin/test_aggregates.py
@@ -26,7 +26,6 @@
"""
_host_key = 'os-extended-server-attributes:host'
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/admin/test_aggregates_negative.py b/tempest/api/compute/v3/admin/test_aggregates_negative.py
index 5700460..1505f74 100644
--- a/tempest/api/compute/v3/admin/test_aggregates_negative.py
+++ b/tempest/api/compute/v3/admin/test_aggregates_negative.py
@@ -26,8 +26,6 @@
Tests Aggregates API that require admin privileges
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(AggregatesAdminNegativeV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_availability_zone.py b/tempest/api/compute/v3/admin/test_availability_zone.py
index 176751f..9ca8953 100644
--- a/tempest/api/compute/v3/admin/test_availability_zone.py
+++ b/tempest/api/compute/v3/admin/test_availability_zone.py
@@ -23,8 +23,6 @@
Tests Availability Zone API List
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(AZAdminV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_availability_zone_negative.py b/tempest/api/compute/v3/admin/test_availability_zone_negative.py
index 180f298..f3af6df 100644
--- a/tempest/api/compute/v3/admin/test_availability_zone_negative.py
+++ b/tempest/api/compute/v3/admin/test_availability_zone_negative.py
@@ -24,8 +24,6 @@
Tests Availability Zone API List
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(AZAdminNegativeV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_flavors.py b/tempest/api/compute/v3/admin/test_flavors.py
index 597c99b..401eb85 100644
--- a/tempest/api/compute/v3/admin/test_flavors.py
+++ b/tempest/api/compute/v3/admin/test_flavors.py
@@ -27,8 +27,6 @@
Tests Flavors API Create and Delete that require admin privileges
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(FlavorsAdminV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_flavors_access.py b/tempest/api/compute/v3/admin/test_flavors_access.py
index 43dc726..03305ff 100644
--- a/tempest/api/compute/v3/admin/test_flavors_access.py
+++ b/tempest/api/compute/v3/admin/test_flavors_access.py
@@ -25,8 +25,6 @@
Add and remove Flavor Access require admin privileges.
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(FlavorsAccessV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_flavors_access_negative.py b/tempest/api/compute/v3/admin/test_flavors_access_negative.py
index 6a2e826..334d124 100644
--- a/tempest/api/compute/v3/admin/test_flavors_access_negative.py
+++ b/tempest/api/compute/v3/admin/test_flavors_access_negative.py
@@ -28,8 +28,6 @@
Add and remove Flavor Access require admin privileges.
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(FlavorsAccessNegativeV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_flavors_extra_specs.py b/tempest/api/compute/v3/admin/test_flavors_extra_specs.py
index 4d22027..29cd8db 100644
--- a/tempest/api/compute/v3/admin/test_flavors_extra_specs.py
+++ b/tempest/api/compute/v3/admin/test_flavors_extra_specs.py
@@ -26,8 +26,6 @@
GET Flavor Extra specs can be performed even by without admin privileges.
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(FlavorsExtraSpecsV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_flavors_extra_specs_negative.py b/tempest/api/compute/v3/admin/test_flavors_extra_specs_negative.py
index 98e6e3d..e9c04a3 100644
--- a/tempest/api/compute/v3/admin/test_flavors_extra_specs_negative.py
+++ b/tempest/api/compute/v3/admin/test_flavors_extra_specs_negative.py
@@ -27,8 +27,6 @@
SET, UNSET, UPDATE Flavor Extra specs require admin privileges.
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(FlavorsExtraSpecsNegativeV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_flavors_negative.py b/tempest/api/compute/v3/admin/test_flavors_negative.py
index f54de79..3f8a2da 100644
--- a/tempest/api/compute/v3/admin/test_flavors_negative.py
+++ b/tempest/api/compute/v3/admin/test_flavors_negative.py
@@ -27,8 +27,6 @@
Tests Flavors API Create and Delete that require admin privileges
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(FlavorsAdminNegativeV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_hosts.py b/tempest/api/compute/v3/admin/test_hosts.py
index 2c9369f..8cb1f23 100644
--- a/tempest/api/compute/v3/admin/test_hosts.py
+++ b/tempest/api/compute/v3/admin/test_hosts.py
@@ -23,8 +23,6 @@
Tests hosts API using admin privileges.
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(HostsAdminV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_hosts_negative.py b/tempest/api/compute/v3/admin/test_hosts_negative.py
index ac5d7de..79cd97f 100644
--- a/tempest/api/compute/v3/admin/test_hosts_negative.py
+++ b/tempest/api/compute/v3/admin/test_hosts_negative.py
@@ -24,8 +24,6 @@
Tests hosts API using admin privileges.
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(HostsAdminNegativeV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_hypervisor.py b/tempest/api/compute/v3/admin/test_hypervisor.py
index 0f96bba..93d4441 100644
--- a/tempest/api/compute/v3/admin/test_hypervisor.py
+++ b/tempest/api/compute/v3/admin/test_hypervisor.py
@@ -23,8 +23,6 @@
Tests Hypervisors API that require admin privileges
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(HypervisorAdminV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_hypervisor_negative.py b/tempest/api/compute/v3/admin/test_hypervisor_negative.py
index aee354a..45642b7 100644
--- a/tempest/api/compute/v3/admin/test_hypervisor_negative.py
+++ b/tempest/api/compute/v3/admin/test_hypervisor_negative.py
@@ -27,8 +27,6 @@
Tests Hypervisors API that require admin privileges
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(HypervisorAdminNegativeV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_quotas.py b/tempest/api/compute/v3/admin/test_quotas.py
index 3ebbdeb..0c138bb 100644
--- a/tempest/api/compute/v3/admin/test_quotas.py
+++ b/tempest/api/compute/v3/admin/test_quotas.py
@@ -16,14 +16,12 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
-from tempest import exceptions
from tempest import test
CONF = config.CONF
class QuotasAdminV3Test(base.BaseV3ComputeAdminTest):
- _interface = 'json'
force_tenant_isolation = True
@classmethod
@@ -54,6 +52,22 @@
sorted(quota_set.keys()))
self.assertEqual(quota_set['id'], self.demo_tenant_id)
+ @test.attr(type='smoke')
+ def test_get_quota_set_detail(self):
+ # Admin can get the detail of resource quota set for a tenant
+ expected_quota_set = self.default_quota_set | set(['id'])
+ expected_detail = {'reserved', 'limit', 'in_use'}
+ resp, quota_set = self.adm_client.get_quota_set_detail(
+ self.demo_tenant_id)
+ self.assertEqual(200, resp.status)
+ self.assertEqual(sorted(expected_quota_set), sorted(quota_set.keys()))
+ self.assertEqual(quota_set['id'], self.demo_tenant_id)
+ for quota in quota_set:
+ if quota == 'id':
+ continue
+ self.assertEqual(sorted(expected_detail),
+ sorted(quota_set[quota].keys()))
+
@test.attr(type='gate')
def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant
@@ -95,56 +109,3 @@
resp, quota_set = self.adm_client.get_quota_set(tenant_id)
self.assertEqual(200, resp.status)
self.assertEqual(quota_set['ram'], 5120)
-
- # TODO(afazekas): Add dedicated tenant to the skiped quota tests
- # it can be moved into the setUpClass as well
- @test.attr(type='gate')
- def test_create_server_when_cpu_quota_is_full(self):
- # Disallow server creation when tenant's vcpu quota is full
- resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
- default_vcpu_quota = quota_set['cores']
- vcpu_quota = 0 # Set the quota to zero to conserve resources
-
- resp, quota_set = self.adm_client.update_quota_set(self.demo_tenant_id,
- force=True,
- cores=vcpu_quota)
-
- self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
- cores=default_vcpu_quota)
- self.assertRaises(exceptions.OverLimit, self.create_test_server)
-
- @test.attr(type='gate')
- def test_create_server_when_memory_quota_is_full(self):
- # Disallow server creation when tenant's memory quota is full
- resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
- default_mem_quota = quota_set['ram']
- mem_quota = 0 # Set the quota to zero to conserve resources
-
- self.adm_client.update_quota_set(self.demo_tenant_id,
- force=True,
- ram=mem_quota)
-
- self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
- ram=default_mem_quota)
- self.assertRaises(exceptions.OverLimit, self.create_test_server)
-
- @test.attr(type='gate')
- def test_update_quota_normal_user(self):
- self.assertRaises(exceptions.Unauthorized,
- self.client.update_quota_set,
- self.demo_tenant_id,
- ram=0)
-
- @test.attr(type=['negative', 'gate'])
- def test_create_server_when_instances_quota_is_full(self):
- # Once instances quota limit is reached, disallow server creation
- resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
- default_instances_quota = quota_set['instances']
- instances_quota = 0 # Set quota to zero to disallow server creation
-
- self.adm_client.update_quota_set(self.demo_tenant_id,
- force=True,
- instances=instances_quota)
- self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
- instances=default_instances_quota)
- self.assertRaises(exceptions.OverLimit, self.create_test_server)
diff --git a/tempest/api/compute/v3/admin/test_quotas_negative.py b/tempest/api/compute/v3/admin/test_quotas_negative.py
new file mode 100644
index 0000000..c9f14f8
--- /dev/null
+++ b/tempest/api/compute/v3/admin/test_quotas_negative.py
@@ -0,0 +1,88 @@
+# Copyright 2013 OpenStack Foundation
+# Copyright 2014 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.api.compute import base
+from tempest import exceptions
+from tempest import test
+
+
+class QuotasAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
+ _interface = 'json'
+ force_tenant_isolation = True
+
+ @classmethod
+ def setUpClass(cls):
+ super(QuotasAdminNegativeV3Test, cls).setUpClass()
+ cls.client = cls.quotas_client
+ cls.adm_client = cls.quotas_admin_client
+
+ # NOTE(afazekas): these test cases should always create and use a new
+ # tenant most of them should be skipped if we can't do that
+ cls.demo_tenant_id = cls.isolated_creds.get_primary_user().get(
+ 'tenantId')
+
+ # TODO(afazekas): Add dedicated tenant to the skiped quota tests
+ # it can be moved into the setUpClass as well
+ @test.attr(type=['negative', 'gate'])
+ def test_create_server_when_cpu_quota_is_full(self):
+ # Disallow server creation when tenant's vcpu quota is full
+ resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ default_vcpu_quota = quota_set['cores']
+ vcpu_quota = 0 # Set the quota to zero to conserve resources
+
+ resp, quota_set = self.adm_client.update_quota_set(self.demo_tenant_id,
+ force=True,
+ cores=vcpu_quota)
+
+ self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
+ cores=default_vcpu_quota)
+ self.assertRaises(exceptions.OverLimit, self.create_test_server)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_server_when_memory_quota_is_full(self):
+ # Disallow server creation when tenant's memory quota is full
+ resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ default_mem_quota = quota_set['ram']
+ mem_quota = 0 # Set the quota to zero to conserve resources
+
+ self.adm_client.update_quota_set(self.demo_tenant_id,
+ force=True,
+ ram=mem_quota)
+
+ self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
+ ram=default_mem_quota)
+ self.assertRaises(exceptions.OverLimit, self.create_test_server)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_update_quota_normal_user(self):
+ self.assertRaises(exceptions.Unauthorized,
+ self.client.update_quota_set,
+ self.demo_tenant_id,
+ ram=0)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_server_when_instances_quota_is_full(self):
+ # Once instances quota limit is reached, disallow server creation
+ resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ default_instances_quota = quota_set['instances']
+ instances_quota = 0 # Set quota to zero to disallow server creation
+
+ self.adm_client.update_quota_set(self.demo_tenant_id,
+ force=True,
+ instances=instances_quota)
+ self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
+ instances=default_instances_quota)
+ self.assertRaises(exceptions.OverLimit, self.create_test_server)
diff --git a/tempest/api/compute/v3/admin/test_servers.py b/tempest/api/compute/v3/admin/test_servers.py
index 0dc3dbc..7787770 100644
--- a/tempest/api/compute/v3/admin/test_servers.py
+++ b/tempest/api/compute/v3/admin/test_servers.py
@@ -25,7 +25,6 @@
"""
_host_key = 'os-extended-server-attributes:host'
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/admin/test_servers_negative.py b/tempest/api/compute/v3/admin/test_servers_negative.py
index a6a5736..cc1be4e 100644
--- a/tempest/api/compute/v3/admin/test_servers_negative.py
+++ b/tempest/api/compute/v3/admin/test_servers_negative.py
@@ -26,8 +26,6 @@
Tests Servers API using admin privileges
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(ServersAdminNegativeV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_services.py b/tempest/api/compute/v3/admin/test_services.py
index 8d6e549..914a2a4 100644
--- a/tempest/api/compute/v3/admin/test_services.py
+++ b/tempest/api/compute/v3/admin/test_services.py
@@ -24,8 +24,6 @@
Tests Services API. List and Enable/Disable require admin privileges.
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(ServicesAdminV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/admin/test_services_negative.py b/tempest/api/compute/v3/admin/test_services_negative.py
index c270842..3168af2 100644
--- a/tempest/api/compute/v3/admin/test_services_negative.py
+++ b/tempest/api/compute/v3/admin/test_services_negative.py
@@ -25,8 +25,6 @@
Tests Services API. List and Enable/Disable require admin privileges.
"""
- _interface = 'json'
-
@classmethod
def setUpClass(cls):
super(ServicesAdminNegativeV3Test, cls).setUpClass()
diff --git a/tempest/api/compute/v3/certificates/test_certificates.py b/tempest/api/compute/v3/certificates/test_certificates.py
index 5c980c0..ce025fc 100644
--- a/tempest/api/compute/v3/certificates/test_certificates.py
+++ b/tempest/api/compute/v3/certificates/test_certificates.py
@@ -18,7 +18,6 @@
class CertificatesV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@attr(type='gate')
def test_create_and_get_root_certificate(self):
diff --git a/tempest/api/compute/v3/flavors/test_flavors.py b/tempest/api/compute/v3/flavors/test_flavors.py
index 812358f..a0bbba6 100644
--- a/tempest/api/compute/v3/flavors/test_flavors.py
+++ b/tempest/api/compute/v3/flavors/test_flavors.py
@@ -18,7 +18,6 @@
class FlavorsV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/flavors/test_flavors_negative.py b/tempest/api/compute/v3/flavors/test_flavors_negative.py
index 3d4100a..346f6d6 100644
--- a/tempest/api/compute/v3/flavors/test_flavors_negative.py
+++ b/tempest/api/compute/v3/flavors/test_flavors_negative.py
@@ -24,7 +24,6 @@
class FlavorsListNegativeV3Test(base.BaseV3ComputeTest,
test.NegativeAutoTest):
- _interface = 'json'
_service = 'computev3'
_schema_file = 'compute/flavors/flavors_list_v3.json'
@@ -37,7 +36,6 @@
class FlavorDetailsNegativeV3Test(base.BaseV3ComputeTest,
test.NegativeAutoTest):
- _interface = 'json'
_service = 'computev3'
_schema_file = 'compute/flavors/flavor_details_v3.json'
diff --git a/tempest/api/compute/v3/images/test_images.py b/tempest/api/compute/v3/images/test_images.py
index b045630..656f7ba 100644
--- a/tempest/api/compute/v3/images/test_images.py
+++ b/tempest/api/compute/v3/images/test_images.py
@@ -22,7 +22,6 @@
class ImagesV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/images/test_images_oneserver.py b/tempest/api/compute/v3/images/test_images_oneserver.py
index 1ded4e4..48a885e 100644
--- a/tempest/api/compute/v3/images/test_images_oneserver.py
+++ b/tempest/api/compute/v3/images/test_images_oneserver.py
@@ -26,7 +26,6 @@
class ImagesOneServerV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
def setUp(self):
# NOTE(afazekas): Normally we use the same server with all test cases,
diff --git a/tempest/api/compute/v3/images/test_images_oneserver_negative.py b/tempest/api/compute/v3/images/test_images_oneserver_negative.py
index 8d2517e..7679eee 100644
--- a/tempest/api/compute/v3/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/v3/images/test_images_oneserver_negative.py
@@ -27,7 +27,6 @@
class ImagesOneServerNegativeV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
def tearDown(self):
"""Terminate test instances created after a test is executed."""
diff --git a/tempest/api/compute/v3/keypairs/test_keypairs.py b/tempest/api/compute/v3/keypairs/test_keypairs.py
index 8eef811..668a295 100644
--- a/tempest/api/compute/v3/keypairs/test_keypairs.py
+++ b/tempest/api/compute/v3/keypairs/test_keypairs.py
@@ -19,7 +19,6 @@
class KeyPairsV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/keypairs/test_keypairs_negative.py b/tempest/api/compute/v3/keypairs/test_keypairs_negative.py
index ae22ccc..e426b85 100644
--- a/tempest/api/compute/v3/keypairs/test_keypairs_negative.py
+++ b/tempest/api/compute/v3/keypairs/test_keypairs_negative.py
@@ -21,7 +21,6 @@
class KeyPairsNegativeV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/servers/test_attach_interfaces.py b/tempest/api/compute/v3/servers/test_attach_interfaces.py
index 272cb53..a3046c7 100644
--- a/tempest/api/compute/v3/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/v3/servers/test_attach_interfaces.py
@@ -24,7 +24,6 @@
class AttachInterfacesV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/servers/test_attach_volume.py b/tempest/api/compute/v3/servers/test_attach_volume.py
index 2edf934..8577aab 100644
--- a/tempest/api/compute/v3/servers/test_attach_volume.py
+++ b/tempest/api/compute/v3/servers/test_attach_volume.py
@@ -24,7 +24,6 @@
class AttachVolumeV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
run_ssh = CONF.compute.run_ssh
def __init__(self, *args, **kwargs):
diff --git a/tempest/api/compute/v3/servers/test_create_server.py b/tempest/api/compute/v3/servers/test_create_server.py
index 0825381..a212ca5 100644
--- a/tempest/api/compute/v3/servers/test_create_server.py
+++ b/tempest/api/compute/v3/servers/test_create_server.py
@@ -28,7 +28,6 @@
class ServersV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
run_ssh = CONF.compute.run_ssh
disk_config = 'AUTO'
@@ -119,7 +118,6 @@
class ServersWithSpecificFlavorV3Test(base.BaseV3ComputeAdminTest):
- _interface = 'json'
run_ssh = CONF.compute.run_ssh
disk_config = 'AUTO'
diff --git a/tempest/api/compute/v3/servers/test_instance_actions.py b/tempest/api/compute/v3/servers/test_instance_actions.py
index d536871..7d25100 100644
--- a/tempest/api/compute/v3/servers/test_instance_actions.py
+++ b/tempest/api/compute/v3/servers/test_instance_actions.py
@@ -14,22 +14,20 @@
# under the License.
from tempest.api.compute import base
-from tempest import exceptions
-from tempest.test import attr
+from tempest import test
class InstanceActionsV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
super(InstanceActionsV3Test, cls).setUpClass()
cls.client = cls.servers_client
resp, server = cls.create_test_server(wait_until='ACTIVE')
- cls.request_id = resp['x-compute-request-id']
+ cls.resp = resp
cls.server_id = server['id']
- @attr(type='gate')
+ @test.attr(type='gate')
def test_list_instance_actions(self):
# List actions of the provided server
resp, body = self.client.reboot(self.server_id, 'HARD')
@@ -41,23 +39,13 @@
self.assertTrue(any([i for i in body if i['action'] == 'create']))
self.assertTrue(any([i for i in body if i['action'] == 'reboot']))
- @attr(type='gate')
+ @test.attr(type='gate')
+ @test.skip_because(bug="1281915")
def test_get_instance_action(self):
# Get the action details of the provided server
+ request_id = self.resp['x-compute-request-id']
resp, body = self.client.get_instance_action(self.server_id,
- self.request_id)
+ request_id)
self.assertEqual(200, resp.status)
self.assertEqual(self.server_id, body['instance_uuid'])
self.assertEqual('create', body['action'])
-
- @attr(type=['negative', 'gate'])
- def test_list_instance_actions_invalid_server(self):
- # List actions of the invalid server id
- self.assertRaises(exceptions.NotFound,
- self.client.list_instance_actions, 'server-999')
-
- @attr(type=['negative', 'gate'])
- def test_get_instance_action_invalid_request(self):
- # Get the action details of the provided server with invalid request
- self.assertRaises(exceptions.NotFound, self.client.get_instance_action,
- self.server_id, '999')
diff --git a/tempest/api/compute/v3/servers/test_instance_actions_negative.py b/tempest/api/compute/v3/servers/test_instance_actions_negative.py
new file mode 100644
index 0000000..bd741e0
--- /dev/null
+++ b/tempest/api/compute/v3/servers/test_instance_actions_negative.py
@@ -0,0 +1,44 @@
+# Copyright 2014 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.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest import test
+
+
+class InstanceActionsNegativeV3Test(base.BaseV3ComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(InstanceActionsNegativeV3Test, cls).setUpClass()
+ cls.client = cls.servers_client
+ resp, server = cls.create_test_server(wait_until='ACTIVE')
+ cls.server_id = server['id']
+
+ @test.attr(type=['negative', 'gate'])
+ def test_list_instance_actions_invalid_server(self):
+ # List actions of the invalid server id
+ invalid_server_id = data_utils.rand_uuid()
+ self.assertRaises(exceptions.NotFound,
+ self.client.list_instance_actions, invalid_server_id)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_get_instance_action_invalid_request(self):
+ # Get the action details of the provided server with invalid request
+ invalid_request_id = 'req-' + data_utils.rand_uuid()
+ self.assertRaises(exceptions.NotFound, self.client.get_instance_action,
+ self.server_id, invalid_request_id)
diff --git a/tempest/api/compute/v3/servers/test_list_server_filters.py b/tempest/api/compute/v3/servers/test_list_server_filters.py
index e08125b..ec31e8e 100644
--- a/tempest/api/compute/v3/servers/test_list_server_filters.py
+++ b/tempest/api/compute/v3/servers/test_list_server_filters.py
@@ -24,7 +24,6 @@
class ListServerFiltersV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/servers/test_list_servers_negative.py b/tempest/api/compute/v3/servers/test_list_servers_negative.py
index 09e1bb6..9a46193 100644
--- a/tempest/api/compute/v3/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/v3/servers/test_list_servers_negative.py
@@ -21,7 +21,6 @@
class ListServersNegativeV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
force_tenant_isolation = True
@classmethod
diff --git a/tempest/api/compute/v3/servers/test_multiple_create.py b/tempest/api/compute/v3/servers/test_multiple_create.py
index f1ae5f8..23e0854 100644
--- a/tempest/api/compute/v3/servers/test_multiple_create.py
+++ b/tempest/api/compute/v3/servers/test_multiple_create.py
@@ -15,12 +15,10 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest import test
class MultipleCreateV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
_name = 'multiple-create-test'
def _generate_name(self):
@@ -47,38 +45,6 @@
self.assertEqual('202', resp['status'])
self.assertNotIn('reservation_id', body)
- @test.attr(type=['negative', 'gate'])
- def test_min_count_less_than_one(self):
- invalid_min_count = 0
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
- min_count=invalid_min_count)
-
- @test.attr(type=['negative', 'gate'])
- def test_min_count_non_integer(self):
- invalid_min_count = 2.5
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
- min_count=invalid_min_count)
-
- @test.attr(type=['negative', 'gate'])
- def test_max_count_less_than_one(self):
- invalid_max_count = 0
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
- max_count=invalid_max_count)
-
- @test.attr(type=['negative', 'gate'])
- def test_max_count_non_integer(self):
- invalid_max_count = 2.5
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
- max_count=invalid_max_count)
-
- @test.attr(type=['negative', 'gate'])
- def test_max_count_less_than_min_count(self):
- min_count = 3
- max_count = 2
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
- min_count=min_count,
- max_count=max_count)
-
@test.attr(type='gate')
def test_multiple_create_with_reservation_return(self):
resp, body = self._create_multiple_servers(wait_until='ACTIVE',
diff --git a/tempest/api/compute/v3/servers/test_multiple_create_negative.py b/tempest/api/compute/v3/servers/test_multiple_create_negative.py
new file mode 100644
index 0000000..57bb807
--- /dev/null
+++ b/tempest/api/compute/v3/servers/test_multiple_create_negative.py
@@ -0,0 +1,69 @@
+# Copyright 2013 IBM Corp
+# 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.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest import test
+
+
+class MultipleCreateV3NegativeTest(base.BaseV3ComputeTest):
+ _interface = 'json'
+ _name = 'multiple-create-negative-test'
+
+ def _generate_name(self):
+ return data_utils.rand_name(self._name)
+
+ def _create_multiple_servers(self, name=None, wait_until=None, **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', self._generate_name())
+ resp, body = self.create_test_server(**kwargs)
+
+ return resp, body
+
+ @test.attr(type=['negative', 'gate'])
+ def test_min_count_less_than_one(self):
+ invalid_min_count = 0
+ self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ min_count=invalid_min_count)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_min_count_non_integer(self):
+ invalid_min_count = 2.5
+ self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ min_count=invalid_min_count)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_max_count_less_than_one(self):
+ invalid_max_count = 0
+ self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ max_count=invalid_max_count)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_max_count_non_integer(self):
+ invalid_max_count = 2.5
+ self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ max_count=invalid_max_count)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_max_count_less_than_min_count(self):
+ min_count = 3
+ max_count = 2
+ self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ min_count=min_count,
+ max_count=max_count)
diff --git a/tempest/api/compute/v3/servers/test_server_actions.py b/tempest/api/compute/v3/servers/test_server_actions.py
index 6584b93..e642715 100644
--- a/tempest/api/compute/v3/servers/test_server_actions.py
+++ b/tempest/api/compute/v3/servers/test_server_actions.py
@@ -28,7 +28,6 @@
class ServerActionsV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
resize_available = CONF.compute_feature_enabled.resize
run_ssh = CONF.compute.run_ssh
diff --git a/tempest/api/compute/v3/servers/test_server_addresses.py b/tempest/api/compute/v3/servers/test_server_addresses.py
index 038e254..335bd3d 100644
--- a/tempest/api/compute/v3/servers/test_server_addresses.py
+++ b/tempest/api/compute/v3/servers/test_server_addresses.py
@@ -22,7 +22,6 @@
class ServerAddressesV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/servers/test_server_metadata.py b/tempest/api/compute/v3/servers/test_server_metadata.py
index 13c82dd..0e4ef07 100644
--- a/tempest/api/compute/v3/servers/test_server_metadata.py
+++ b/tempest/api/compute/v3/servers/test_server_metadata.py
@@ -18,7 +18,6 @@
class ServerMetadataV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/servers/test_server_metadata_negative.py b/tempest/api/compute/v3/servers/test_server_metadata_negative.py
index ce6c340..ec2bc8c 100644
--- a/tempest/api/compute/v3/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/v3/servers/test_server_metadata_negative.py
@@ -19,7 +19,6 @@
class ServerMetadataV3NegativeTest(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/servers/test_server_password.py b/tempest/api/compute/v3/servers/test_server_password.py
index 579a8a5..fc0b145 100644
--- a/tempest/api/compute/v3/servers/test_server_password.py
+++ b/tempest/api/compute/v3/servers/test_server_password.py
@@ -19,7 +19,6 @@
class ServerPasswordV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/servers/test_server_rescue.py b/tempest/api/compute/v3/servers/test_server_rescue.py
index fa7def0..5d7f91d 100644
--- a/tempest/api/compute/v3/servers/test_server_rescue.py
+++ b/tempest/api/compute/v3/servers/test_server_rescue.py
@@ -20,7 +20,6 @@
class ServerRescueV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/servers/test_servers.py b/tempest/api/compute/v3/servers/test_servers.py
index 5480e31..426ee8d 100644
--- a/tempest/api/compute/v3/servers/test_servers.py
+++ b/tempest/api/compute/v3/servers/test_servers.py
@@ -19,7 +19,6 @@
class ServersV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/servers/test_servers_negative.py b/tempest/api/compute/v3/servers/test_servers_negative.py
index 12e0ad8..cb5e93d 100644
--- a/tempest/api/compute/v3/servers/test_servers_negative.py
+++ b/tempest/api/compute/v3/servers/test_servers_negative.py
@@ -27,7 +27,6 @@
class ServersNegativeV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
def setUp(self):
super(ServersNegativeV3Test, self).setUp()
diff --git a/tempest/api/compute/v3/test_extensions.py b/tempest/api/compute/v3/test_extensions.py
index 09f5ab4..3c612df 100644
--- a/tempest/api/compute/v3/test_extensions.py
+++ b/tempest/api/compute/v3/test_extensions.py
@@ -25,7 +25,6 @@
class ExtensionsV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@test.attr(type='gate')
def test_list_extensions(self):
diff --git a/tempest/api/compute/v3/test_live_block_migration.py b/tempest/api/compute/v3/test_live_block_migration.py
index 43b4e2b..33d2bd9 100644
--- a/tempest/api/compute/v3/test_live_block_migration.py
+++ b/tempest/api/compute/v3/test_live_block_migration.py
@@ -24,7 +24,6 @@
class LiveBlockMigrationV3Test(base.BaseV3ComputeAdminTest):
_host_key = 'os-extended-server-attributes:host'
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/test_live_block_migration_negative.py b/tempest/api/compute/v3/test_live_block_migration_negative.py
index 4d820d8..b4ec505 100644
--- a/tempest/api/compute/v3/test_live_block_migration_negative.py
+++ b/tempest/api/compute/v3/test_live_block_migration_negative.py
@@ -25,7 +25,6 @@
class LiveBlockMigrationV3NegativeTest(base.BaseV3ComputeAdminTest):
_host_key = 'os-extended-server-attributes:host'
- _interface = 'json'
@classmethod
def setUpClass(cls):
@@ -39,7 +38,7 @@
def _migrate_server_to(self, server_id, dest_host):
_resp, body = self.admin_servers_client.live_migrate_server(
server_id, dest_host,
- self.config.compute_feature_enabled.
+ CONF.compute_feature_enabled.
block_migration_for_live_migration)
return body
diff --git a/tempest/api/compute/v3/test_quotas.py b/tempest/api/compute/v3/test_quotas.py
index 33b90ff..b53d9be 100644
--- a/tempest/api/compute/v3/test_quotas.py
+++ b/tempest/api/compute/v3/test_quotas.py
@@ -18,7 +18,6 @@
class QuotasV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/compute/v3/test_version.py b/tempest/api/compute/v3/test_version.py
index 9161d4d..1a74e35 100644
--- a/tempest/api/compute/v3/test_version.py
+++ b/tempest/api/compute/v3/test_version.py
@@ -19,7 +19,6 @@
class VersionV3Test(base.BaseV3ComputeTest):
- _interface = 'json'
@test.attr(type='gate')
def test_version(self):
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index f309897..be03a03 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -16,7 +16,7 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest import exceptions
-from tempest.test import attr
+from tempest import test
class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
@@ -28,7 +28,7 @@
self.assertRaises(
exceptions.NotFound, self.client.get_project, project_id)
- @attr(type='gate')
+ @test.attr(type='gate')
def test_project_list_delete(self):
# Create several projects and delete them
for _ in xrange(3):
@@ -42,7 +42,7 @@
resp, get_project = self.client.get_project(project['id'])
self.assertIn(get_project, list_projects)
- @attr(type='gate')
+ @test.attr(type='gate')
def test_project_create_with_description(self):
# Create project with a description
project_name = data_utils.rand_name('project-')
@@ -61,7 +61,7 @@
self.assertEqual(desc2, project_desc, 'Description does not appear'
'to be set')
- @attr(type='gate')
+ @test.attr(type='gate')
def test_project_create_enabled(self):
# Create a project that is enabled
project_name = data_utils.rand_name('project-')
@@ -77,7 +77,7 @@
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
- @attr(type='gate')
+ @test.attr(type='gate')
def test_project_create_not_enabled(self):
# Create a project that is not enabled
project_name = data_utils.rand_name('project-')
@@ -94,7 +94,7 @@
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
- @attr(type='gate')
+ @test.attr(type='gate')
def test_project_update_name(self):
# Update name attribute of a project
p_name1 = data_utils.rand_name('project-')
@@ -117,7 +117,7 @@
self.assertEqual(p_name1, resp1_name)
self.assertEqual(resp2_name, resp3_name)
- @attr(type='gate')
+ @test.attr(type='gate')
def test_project_update_desc(self):
# Update description attribute of a project
p_name = data_utils.rand_name('project-')
@@ -142,7 +142,7 @@
self.assertEqual(p_desc, resp1_desc)
self.assertEqual(resp2_desc, resp3_desc)
- @attr(type='gate')
+ @test.attr(type='gate')
def test_project_update_enable(self):
# Update the enabled attribute of a project
p_name = data_utils.rand_name('project-')
@@ -167,7 +167,7 @@
self.assertEqual('false', str(resp1_en).lower())
self.assertEqual(resp2_en, resp3_en)
- @attr(type='gate')
+ @test.attr(type='gate')
def test_associate_user_to_project(self):
#Associate a user to a project
#Create a Project
@@ -196,59 +196,6 @@
new_user_get['project_id'])
self.assertEqual(u_email, new_user_get['email'])
- @attr(type=['negative', 'gate'])
- def test_list_projects_by_unauthorized_user(self):
- # Non-admin user should not be able to list projects
- self.assertRaises(exceptions.Unauthorized,
- self.non_admin_client.list_projects)
-
- @attr(type=['negative', 'gate'])
- def test_project_create_duplicate(self):
- # Project names should be unique
- project_name = data_utils.rand_name('project-dup-')
- resp, project = self.client.create_project(project_name)
- self.data.projects.append(project)
-
- self.assertRaises(
- exceptions.Conflict, self.client.create_project, project_name)
-
- @attr(type=['negative', 'gate'])
- def test_create_project_by_unauthorized_user(self):
- # Non-admin user should not be authorized to create a project
- project_name = data_utils.rand_name('project-')
- self.assertRaises(
- exceptions.Unauthorized, self.non_admin_client.create_project,
- project_name)
-
- @attr(type=['negative', 'gate'])
- def test_create_project_with_empty_name(self):
- # Project name should not be empty
- self.assertRaises(exceptions.BadRequest, self.client.create_project,
- name='')
-
- @attr(type=['negative', 'gate'])
- def test_create_projects_name_length_over_64(self):
- # Project name length should not be greater than 64 characters
- project_name = 'a' * 65
- self.assertRaises(exceptions.BadRequest, self.client.create_project,
- project_name)
-
- @attr(type=['negative', 'gate'])
- def test_project_delete_by_unauthorized_user(self):
- # Non-admin user should not be able to delete a project
- project_name = data_utils.rand_name('project-')
- resp, project = self.client.create_project(project_name)
- self.data.projects.append(project)
- self.assertRaises(
- exceptions.Unauthorized, self.non_admin_client.delete_project,
- project['id'])
-
- @attr(type=['negative', 'gate'])
- def test_delete_non_existent_project(self):
- # Attempt to delete a non existent project should fail
- self.assertRaises(exceptions.NotFound, self.client.delete_project,
- 'junk_Project_123456abc')
-
class ProjectsTestXML(ProjectsTestJSON):
_interface = 'xml'
diff --git a/tempest/api/identity/admin/v3/test_projects_negative.py b/tempest/api/identity/admin/v3/test_projects_negative.py
new file mode 100644
index 0000000..6b60d04
--- /dev/null
+++ b/tempest/api/identity/admin/v3/test_projects_negative.py
@@ -0,0 +1,80 @@
+# Copyright 2013 OpenStack, LLC
+# 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.api.identity import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest import test
+
+
+class ProjectsNegativeTestJSON(base.BaseIdentityV3AdminTest):
+ _interface = 'json'
+
+ @test.attr(type=['negative', 'gate'])
+ def test_list_projects_by_unauthorized_user(self):
+ # Non-admin user should not be able to list projects
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_admin_client.list_projects)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_project_create_duplicate(self):
+ # Project names should be unique
+ project_name = data_utils.rand_name('project-dup-')
+ resp, project = self.client.create_project(project_name)
+ self.data.projects.append(project)
+
+ self.assertRaises(
+ exceptions.Conflict, self.client.create_project, project_name)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_project_by_unauthorized_user(self):
+ # Non-admin user should not be authorized to create a project
+ project_name = data_utils.rand_name('project-')
+ self.assertRaises(
+ exceptions.Unauthorized, self.non_admin_client.create_project,
+ project_name)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_project_with_empty_name(self):
+ # Project name should not be empty
+ self.assertRaises(exceptions.BadRequest, self.client.create_project,
+ name='')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_projects_name_length_over_64(self):
+ # Project name length should not be greater than 64 characters
+ project_name = 'a' * 65
+ self.assertRaises(exceptions.BadRequest, self.client.create_project,
+ project_name)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_project_delete_by_unauthorized_user(self):
+ # Non-admin user should not be able to delete a project
+ project_name = data_utils.rand_name('project-')
+ resp, project = self.client.create_project(project_name)
+ self.data.projects.append(project)
+ self.assertRaises(
+ exceptions.Unauthorized, self.non_admin_client.delete_project,
+ project['id'])
+
+ @test.attr(type=['negative', 'gate'])
+ def test_delete_non_existent_project(self):
+ # Attempt to delete a non existent project should fail
+ self.assertRaises(exceptions.NotFound, self.client.delete_project,
+ data_utils.rand_uuid_hex())
+
+
+class ProjectsNegativeTestXML(ProjectsNegativeTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/network/base_security_groups.py b/tempest/api/network/base_security_groups.py
index 38ae4ac..90be454 100644
--- a/tempest/api/network/base_security_groups.py
+++ b/tempest/api/network/base_security_groups.py
@@ -26,7 +26,7 @@
def _create_security_group(self):
# Create a security group
name = data_utils.rand_name('secgroup-')
- resp, group_create_body = self.client.create_security_group(name)
+ resp, group_create_body = self.client.create_security_group(name=name)
self.assertEqual('201', resp['status'])
self.addCleanup(self._delete_security_group,
group_create_body['security_group']['id'])
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index d552c70..0ff91ab 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -16,6 +16,7 @@
import netaddr
from tempest.api.network import base_routers as base
+from tempest import clients
from tempest.common.utils import data_utils
from tempest import config
from tempest import test
@@ -32,6 +33,8 @@
if not test.is_extension_enabled('router', 'network'):
msg = "router extension not enabled."
raise cls.skipException(msg)
+ admin_manager = clients.AdminManager()
+ cls.identity_admin_client = admin_manager.identity_client
@test.attr(type='smoke')
def test_create_show_list_update_delete_router(self):
@@ -77,6 +80,25 @@
self.assertEqual(show_body['router']['name'], updated_name)
@test.attr(type='smoke')
+ def test_create_router_setting_tenant_id(self):
+ # Test creating router from admin user setting tenant_id.
+ test_tenant = data_utils.rand_name('test_tenant_')
+ test_description = data_utils.rand_name('desc_')
+ _, tenant = self.identity_admin_client.create_tenant(
+ name=test_tenant,
+ description=test_description)
+ tenant_id = tenant['id']
+ self.addCleanup(self.identity_admin_client.delete_tenant, tenant_id)
+
+ name = data_utils.rand_name('router-')
+ resp, create_body = self.admin_client.create_router(
+ name, tenant_id=tenant_id)
+ self.assertEqual('201', resp['status'])
+ self.addCleanup(self.admin_client.delete_router,
+ create_body['router']['id'])
+ self.assertEqual(tenant_id, create_body['router']['tenant_id'])
+
+ @test.attr(type='smoke')
def test_add_remove_router_interface_with_subnet_id(self):
network = self.create_network()
subnet = self.create_subnet(network)
diff --git a/tempest/api/network/test_security_groups.py b/tempest/api/network/test_security_groups.py
index 6eebf5b..1d41cc9 100644
--- a/tempest/api/network/test_security_groups.py
+++ b/tempest/api/network/test_security_groups.py
@@ -66,8 +66,9 @@
protocols = ['tcp', 'udp', 'icmp']
for protocol in protocols:
resp, rule_create_body = self.client.create_security_group_rule(
- group_create_body['security_group']['id'],
- protocol=protocol
+ security_group_id=group_create_body['security_group']['id'],
+ protocol=protocol,
+ direction='ingress'
)
self.assertEqual('201', resp['status'])
self.addCleanup(self._delete_security_group_rule,
@@ -99,7 +100,7 @@
port_range_min = 77
port_range_max = 77
resp, rule_create_body = self.client.create_security_group_rule(
- group_create_body['security_group']['id'],
+ security_group_id=group_create_body['security_group']['id'],
direction=direction,
protocol=protocol,
port_range_min=port_range_min,
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index e1f4055..0b86398 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -57,10 +57,10 @@
#Create rule with bad protocol name
pname = 'bad_protocol_name'
- self.assertRaises(exceptions.BadRequest,
- self.client.create_security_group_rule,
- group_create_body['security_group']['id'],
- protocol=pname)
+ self.assertRaises(
+ exceptions.BadRequest, self.client.create_security_group_rule,
+ security_group_id=group_create_body['security_group']['id'],
+ protocol=pname, direction='ingress')
@test.attr(type=['negative', 'gate'])
def test_create_security_group_rule_with_invalid_ports(self):
@@ -72,12 +72,11 @@
(80, 65536, 'Invalid value for port 65536'),
(-16, 65536, 'Invalid value for port')]
for pmin, pmax, msg in states:
- ex = self.assertRaises(exceptions.BadRequest,
- self.client.create_security_group_rule,
- group_create_body['security_group']['id'],
- protocol='tcp',
- port_range_min=pmin,
- port_range_max=pmax)
+ ex = self.assertRaises(
+ exceptions.BadRequest, self.client.create_security_group_rule,
+ security_group_id=group_create_body['security_group']['id'],
+ protocol='tcp', port_range_min=pmin, port_range_max=pmax,
+ direction='ingress')
self.assertIn(msg, str(ex))
@test.attr(type=['negative', 'smoke'])
@@ -86,7 +85,7 @@
name = 'default'
self.assertRaises(exceptions.Conflict,
self.client.create_security_group,
- name)
+ name=name)
@test.attr(type=['negative', 'smoke'])
def test_create_security_group_rule_with_non_existent_security_group(self):
@@ -94,7 +93,8 @@
non_existent_sg = str(uuid.uuid4())
self.assertRaises(exceptions.NotFound,
self.client.create_security_group_rule,
- non_existent_sg)
+ security_group_id=non_existent_sg,
+ direction='ingress')
class NegativeSecGroupTestXML(NegativeSecGroupTest):
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index d08dc34..45c895b 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -130,7 +130,10 @@
objlist = container_client.list_all_container_objects(cont)
# delete every object in the container
for obj in objlist:
- object_client.delete_object(cont, obj['name'])
+ try:
+ object_client.delete_object(cont, obj['name'])
+ except exceptions.NotFound:
+ pass
container_client.delete_container(cont)
except exceptions.NotFound:
pass
diff --git a/tempest/auth.py b/tempest/auth.py
index e1ba13b..8cb3b2c 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -382,7 +382,7 @@
path = "/" + filters['api_version']
noversion_path = "/".join(parts.path.split("/")[2:])
if noversion_path != "":
- path += noversion_path
+ path += "/" + noversion_path
_base_url = _base_url.replace(parts.path, path)
if filters.get('skip_path', None) is not None:
_base_url = _base_url.replace(parts.path, "/")
diff --git a/tempest/cli/simple_read_only/test_nova_manage.py b/tempest/cli/simple_read_only/test_nova_manage.py
index 13a1589..f1fee2e 100644
--- a/tempest/cli/simple_read_only/test_nova_manage.py
+++ b/tempest/cli/simple_read_only/test_nova_manage.py
@@ -41,6 +41,10 @@
if not CONF.service_available.nova:
msg = ("%s skipped as Nova is not available" % cls.__name__)
raise cls.skipException(msg)
+ if not CONF.cli.has_manage:
+ msg = ("%s skipped as *-manage commands not available"
+ % cls.__name__)
+ raise cls.skipException(msg)
super(SimpleReadOnlyNovaManageTest, cls).setUpClass()
def test_admin_fake_action(self):
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index dbeba8f..8e6b9fb 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -42,7 +42,7 @@
timeout = client.build_timeout + extra_timeout
while True:
# NOTE(afazekas): Now the BUILD status only reached
- # between the UNKOWN->ACTIVE transition.
+ # between the UNKNOWN->ACTIVE transition.
# TODO(afazekas): enumerate and validate the stable status set
if status == 'BUILD' and server_status != 'UNKNOWN':
return
diff --git a/tempest/config.py b/tempest/config.py
index c92a04d..05a493c 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -15,6 +15,7 @@
from __future__ import print_function
+import logging as std_logging
import os
from oslo.config import cfg
@@ -235,8 +236,8 @@
help="If false, skip disk config tests"),
cfg.ListOpt('api_extensions',
default=['all'],
- help='A list of enabled extensions with a special entry all '
- 'which indicates every extension is enabled'),
+ help='A list of enabled compute extensions with a special '
+ 'entry all which indicates every extension is enabled'),
cfg.ListOpt('api_v3_extensions',
default=['all'],
help='A list of enabled v3 extensions with a special entry all'
@@ -372,8 +373,8 @@
NetworkFeaturesGroup = [
cfg.ListOpt('api_extensions',
default=['all'],
- help='A list of enabled extensions with a special entry all '
- 'which indicates every extension is enabled'),
+ help='A list of enabled network extensions with a special '
+ 'entry all which indicates every extension is enabled'),
]
volume_group = cfg.OptGroup(name='volume',
@@ -430,8 +431,8 @@
help='Runs Cinder volumes backup test'),
cfg.ListOpt('api_extensions',
default=['all'],
- help='A list of enabled extensions with a special entry all '
- 'which indicates every extension is enabled'),
+ help='A list of enabled volume extensions with a special '
+ 'entry all which indicates every extension is enabled'),
cfg.BoolOpt('api_v1',
default=True,
help="Is the v1 volume API enabled"),
@@ -540,6 +541,11 @@
cfg.StrOpt('catalog_type',
default='metering',
help="Catalog type of the Telemetry service."),
+ cfg.StrOpt('endpoint_type',
+ default='publicURL',
+ choices=['public', 'admin', 'internal',
+ 'publicURL', 'adminURL', 'internalURL'],
+ help="The endpoint type to use for the telemetry service."),
]
@@ -562,7 +568,13 @@
DataProcessingGroup = [
cfg.StrOpt('catalog_type',
default='data_processing',
- help="Catalog type of the data processing service.")
+ help="Catalog type of the data processing service."),
+ cfg.StrOpt('endpoint_type',
+ default='publicURL',
+ choices=['public', 'admin', 'internal',
+ 'publicURL', 'adminURL', 'internalURL'],
+ help="The endpoint type to use for the data processing "
+ "service."),
]
@@ -760,6 +772,12 @@
cfg.StrOpt('catalog_type',
default='baremetal',
help="Catalog type of the baremetal provisioning service."),
+ cfg.StrOpt('endpoint_type',
+ default='publicURL',
+ choices=['public', 'admin', 'internal',
+ 'publicURL', 'adminURL', 'internalURL'],
+ help="The endpoint type to use for the baremetal provisioning "
+ "service."),
]
cli_group = cfg.OptGroup(name='cli', title="cli Configuration Options")
@@ -771,6 +789,11 @@
cfg.StrOpt('cli_dir',
default='/usr/local/bin',
help="directory where python client binaries are located"),
+ cfg.BoolOpt('has_manage',
+ default=True,
+ help=("Whether the tempest run location has access to the "
+ "*-manage commands. In a pure blackbox environment "
+ "it will not.")),
cfg.IntOpt('timeout',
default=15,
help="Number of seconds to wait on a CLI timeout"),
@@ -876,6 +899,9 @@
self.compute_admin.password = self.identity.admin_password
self.compute_admin.tenant_name = self.identity.admin_tenant_name
+ if parse_conf:
+ cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
+
class TempestConfigProxy(object):
_config = None
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 6757da6..4c3a01c 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -225,8 +225,9 @@
# so case sensitive comparisons can really mess things
# up.
if new_status.lower() == error_status.lower():
- message = ("%s failed to get to expected status. "
- "In %s state.") % (thing, new_status)
+ message = ("%s failed to get to expected status (%s). "
+ "In %s state.") % (thing, expected_status,
+ new_status)
raise exceptions.BuildErrorException(message,
server_id=thing_id)
elif new_status == expected_status and expected_status is not None:
@@ -290,6 +291,27 @@
image = CONF.compute.image_ref
if flavor is None:
flavor = CONF.compute.flavor_ref
+
+ fixed_network_name = CONF.compute.fixed_network_name
+ if 'nics' not in create_kwargs and fixed_network_name:
+ networks = client.networks.list()
+ # If several networks found, set the NetID on which to connect the
+ # server to avoid the following error "Multiple possible networks
+ # found, use a Network ID to be more specific."
+ # See Tempest #1250866
+ if len(networks) > 1:
+ for network in networks:
+ if network.label == fixed_network_name:
+ create_kwargs['nics'] = [{'net-id': network.id}]
+ break
+ # If we didn't find the network we were looking for :
+ else:
+ msg = ("The network on which the NIC of the server must "
+ "be connected can not be found : "
+ "fixed_network_name=%s. Starting instance without "
+ "specifying a network.") % fixed_network_name
+ LOG.info(msg)
+
LOG.debug("Creating a server (name: %s, image: %s, flavor: %s)",
name, image, flavor)
server = client.servers.create(name, image, flavor, **create_kwargs)
@@ -404,7 +426,7 @@
properties={'disk_format':
'qcow2'})
except IOError:
- LOG.debug("A qcow2 image was not got. Try to get a uec image.")
+ LOG.debug("A qcow2 image was not found. Try to get a uec image.")
kernel = self._image_create('scenario-aki', 'aki', aki_img_path)
ramdisk = self._image_create('scenario-ari', 'ari', ari_img_path)
properties = {
diff --git a/tempest/scenario/test_load_balancer_basic.py b/tempest/scenario/test_load_balancer_basic.py
index 2f7d9d9..5bcdacd 100644
--- a/tempest/scenario/test_load_balancer_basic.py
+++ b/tempest/scenario/test_load_balancer_basic.py
@@ -61,12 +61,8 @@
super(TestLoadBalancerBasic, cls).setUpClass()
cls.check_preconditions()
cls.security_groups = {}
- cls.networks = []
- cls.subnets = []
cls.servers_keypairs = {}
- cls.pools = []
cls.members = []
- cls.vips = []
cls.floating_ips = {}
cls.port1 = 80
cls.port2 = 88
@@ -80,21 +76,19 @@
name = data_utils.rand_name("smoke_server-")
keypair = self.create_keypair(name='keypair-%s' % name)
security_groups = [self.security_groups[tenant_id].name]
- nets = self.network_client.list_networks()
- for net in nets['networks']:
- if net['tenant_id'] == self.tenant_id:
- self.networks.append(net)
- create_kwargs = {
- 'nics': [
- {'net-id': net['id']},
- ],
- 'key_name': keypair.name,
- 'security_groups': security_groups,
- }
- server = self.create_server(name=name,
- create_kwargs=create_kwargs)
- self.servers_keypairs[server] = keypair
- break
+ net = self.list_networks(tenant_id=self.tenant_id)[0]
+ self.network = net_common.DeletableNetwork(client=self.network_client,
+ **net['network'])
+ create_kwargs = {
+ 'nics': [
+ {'net-id': self.network.id},
+ ],
+ 'key_name': keypair.name,
+ 'security_groups': security_groups,
+ }
+ server = self.create_server(name=name,
+ create_kwargs=create_kwargs)
+ self.servers_keypairs[server] = keypair
self.assertTrue(self.servers_keypairs)
def _start_servers(self):
@@ -105,7 +99,7 @@
for server in self.servers_keypairs.keys():
ssh_login = config.compute.image_ssh_user
private_key = self.servers_keypairs[server].private_key
- network_name = self.networks[0]['name']
+ network_name = self.network.name
ip_address = server.networks[network_name][0]
ssh_client = ssh.Client(ip_address, ssh_login,
@@ -138,17 +132,15 @@
def _create_pool(self):
"""Create a pool with ROUND_ROBIN algorithm."""
- subnets = self.network_client.list_subnets()
- for subnet in subnets['subnets']:
- if subnet['tenant_id'] == self.tenant_id:
- self.subnets.append(subnet)
- pool = super(TestLoadBalancerBasic, self)._create_pool(
- 'ROUND_ROBIN',
- 'HTTP',
- subnet['id'])
- self.pools.append(pool)
- break
- self.assertTrue(self.pools)
+ # get tenant subnet and verify there's only one
+ subnet = self._list_subnets(tenant_id=self.tenant_id)[0]
+ self.subnet = net_common.DeletableSubnet(client=self.network_client,
+ **subnet['subnet'])
+ self.pool = super(TestLoadBalancerBasic, self)._create_pool(
+ 'ROUND_ROBIN',
+ 'HTTP',
+ self.subnet.id)
+ self.assertTrue(self.pool)
def _create_members(self, network_name, server_ids):
"""
@@ -161,7 +153,7 @@
for server in servers:
if server.id in server_ids:
ip = server.networks[network_name][0]
- pool_id = self.pools[0]['id']
+ pool_id = self.pool.id
if len(set(server_ids)) == 1 or len(servers) == 1:
member1 = self._create_member(ip, self.port1, pool_id)
member2 = self._create_member(ip, self.port2, pool_id)
@@ -173,28 +165,27 @@
def _assign_floating_ip_to_vip(self, vip):
public_network_id = config.network.public_network_id
- port_id = vip['port_id']
+ port_id = vip.port_id
floating_ip = self._create_floating_ip(vip, public_network_id,
port_id=port_id)
- self.floating_ips.setdefault(vip['id'], [])
- self.floating_ips[vip['id']].append(floating_ip)
+ self.floating_ips.setdefault(vip.id, [])
+ self.floating_ips[vip.id].append(floating_ip)
def _create_load_balancer(self):
self._create_pool()
- self._create_members(self.networks[0]['name'],
+ self._create_members(self.network.name,
[self.servers_keypairs.keys()[0].id])
- subnet_id = self.subnets[0]['id']
- pool_id = self.pools[0]['id']
- vip = super(TestLoadBalancerBasic, self)._create_vip('HTTP', 80,
- subnet_id,
- pool_id)
- self.vips.append(vip)
+ subnet_id = self.subnet.id
+ pool_id = self.pool.id
+ self.vip = super(TestLoadBalancerBasic, self)._create_vip('HTTP', 80,
+ subnet_id,
+ pool_id)
self._status_timeout(NeutronRetriever(self.network_client,
self.network_client.vip_path,
net_common.DeletableVip),
- self.vips[0]['id'],
+ self.vip.id,
expected_status='ACTIVE')
- self._assign_floating_ip_to_vip(self.vips[0])
+ self._assign_floating_ip_to_vip(self.vip)
def _check_load_balancing(self):
"""
@@ -204,9 +195,8 @@
of the requests
"""
- vip = self.vips[0]
- floating_ip_vip = self.floating_ips[
- vip['id']][0]['floating_ip_address']
+ vip = self.vip
+ floating_ip_vip = self.floating_ips[vip.id][0]['floating_ip_address']
self._check_connection(floating_ip_vip)
resp = []
for count in range(10):
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index a4002d4..998a474 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -13,6 +13,7 @@
# 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 collections
from tempest.common import debug
from tempest.common.utils import data_utils
@@ -24,6 +25,9 @@
CONF = config.CONF
LOG = logging.getLogger(__name__)
+Floating_IP_tuple = collections.namedtuple('Floating_IP_tuple',
+ ['floating_ip', 'server'])
+
class TestNetworkBasicOps(manager.NetworkScenarioTest):
@@ -134,7 +138,7 @@
serv_dict = self._create_server(name, self.network)
self.servers[serv_dict['server']] = serv_dict['keypair']
self._check_tenant_network_connectivity()
- self.floating_ips = {}
+
self._create_and_associate_floating_ips()
def check_networks(self):
@@ -178,11 +182,6 @@
self.addCleanup(self.cleanup_wrapper, server)
return dict(server=server, keypair=keypair)
- def _create_servers(self):
- for i, network in enumerate(self.networks):
- name = data_utils.rand_name('server-smoke-%d-' % i)
- self._create_server(name, network)
-
def _check_tenant_network_connectivity(self):
if not CONF.network.tenant_networks_reachable:
msg = 'Tenant networks not configured to be reachable.'
@@ -207,7 +206,7 @@
public_network_id = CONF.network.public_network_id
for server in self.servers.keys():
floating_ip = self._create_floating_ip(server, public_network_id)
- self.floating_ips[floating_ip] = server
+ self.floating_ip_tuple = Floating_IP_tuple(floating_ip, server)
self.addCleanup(self.cleanup_wrapper, floating_ip)
def _check_public_network_connectivity(self, should_connect=True,
@@ -216,16 +215,16 @@
# key-based authentication by cloud-init.
ssh_login = CONF.compute.image_ssh_user
LOG.debug('checking network connections')
+ floating_ip, server = self.floating_ip_tuple
+ ip_address = floating_ip.floating_ip_address
+ private_key = None
+ if should_connect:
+ private_key = self.servers[server].private_key
try:
- for floating_ip, server in self.floating_ips.iteritems():
- ip_address = floating_ip.floating_ip_address
- private_key = None
- if should_connect:
- private_key = self.servers[server].private_key
- self._check_vm_connectivity(ip_address,
- ssh_login,
- private_key,
- should_connect=should_connect)
+ self._check_vm_connectivity(ip_address,
+ ssh_login,
+ private_key,
+ should_connect=should_connect)
except Exception:
ex_msg = 'Public network connectivity check failed'
if msg:
@@ -236,18 +235,20 @@
raise
def _disassociate_floating_ips(self):
- for floating_ip, server in self.floating_ips.iteritems():
- self._disassociate_floating_ip(floating_ip)
- self.floating_ips[floating_ip] = None
+ floating_ip, server = self.floating_ip_tuple
+ self._disassociate_floating_ip(floating_ip)
+ self.floating_ip_tuple = Floating_IP_tuple(
+ floating_ip, None)
def _reassociate_floating_ips(self):
- for floating_ip in self.floating_ips.keys():
- name = data_utils.rand_name('new_server-smoke-')
- # create a new server for the floating ip
- serv_dict = self._create_server(name, self.network)
- self.servers[serv_dict['server']] = serv_dict['keypair']
- self._associate_floating_ip(floating_ip, serv_dict['server'])
- self.floating_ips[floating_ip] = serv_dict['server']
+ floating_ip, server = self.floating_ip_tuple
+ name = data_utils.rand_name('new_server-smoke-')
+ # create a new server for the floating ip
+ serv_dict = self._create_server(name, self.network)
+ self.servers[serv_dict['server']] = serv_dict['keypair']
+ self._associate_floating_ip(floating_ip, serv_dict['server'])
+ self.floating_ip_tuple = Floating_IP_tuple(
+ floating_ip, serv_dict['server'])
@test.attr(type='smoke')
@test.services('compute', 'network')
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 8e4192d..a26e0cf 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -148,9 +148,6 @@
cls.check_preconditions()
# TODO(mnewby) Consider looking up entities as needed instead
# of storing them as collections on the class.
- cls.networks = []
- cls.subnets = []
- cls.routers = []
cls.floating_ips = {}
cls.tenants = {}
cls.primary_tenant = cls.TenantProperties(cls.tenant_id,
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index 1144414..d369f12 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -26,10 +26,6 @@
LOG = logging.getLogger(__name__)
-# NOTE(andreaf) - nose does not honour the load_tests protocol
-# however it's test discovery regex will match anything
-# which includes _tests. So nose would require some further
-# investigation to be supported with this
load_tests = testscenarios.load_tests_apply_scenarios
diff --git a/tempest/services/compute/v3/json/quotas_client.py b/tempest/services/compute/v3/json/quotas_client.py
index a01b9d2..aa8bfaf 100644
--- a/tempest/services/compute/v3/json/quotas_client.py
+++ b/tempest/services/compute/v3/json/quotas_client.py
@@ -35,6 +35,14 @@
body = json.loads(body)
return resp, body['quota_set']
+ def get_quota_set_detail(self, tenant_id):
+ """Get the quota set detail for a tenant."""
+
+ url = 'os-quota-sets/%s/detail' % str(tenant_id)
+ resp, body = self.get(url)
+ body = json.loads(body)
+ return resp, body['quota_set']
+
def get_default_quota_set(self, tenant_id):
"""List the default quota set for a tenant."""
diff --git a/tempest/services/compute/xml/quotas_client.py b/tempest/services/compute/xml/quotas_client.py
index eb287c2..b8b759f 100644
--- a/tempest/services/compute/xml/quotas_client.py
+++ b/tempest/services/compute/xml/quotas_client.py
@@ -44,9 +44,6 @@
return quota
- def _parse_array(self, node):
- return [self._format_quota(xml_to_json(x)) for x in node]
-
def get_quota_set(self, tenant_id):
"""List the quota set for a tenant."""
diff --git a/tempest/services/identity/v3/xml/service_client.py b/tempest/services/identity/v3/xml/service_client.py
index d5476c4..d4a5877 100644
--- a/tempest/services/identity/v3/xml/service_client.py
+++ b/tempest/services/identity/v3/xml/service_client.py
@@ -35,12 +35,6 @@
self.endpoint_url = 'adminURL'
self.api_version = "v3"
- def _parse_array(self, node):
- array = []
- for child in node.getchildren():
- array.append(xml_to_json(child))
- return array
-
def _parse_body(self, body):
data = xml_to_json(body)
return data
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 81dbfbc..366ccee 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -154,20 +154,6 @@
body = json.loads(body)
return resp, body
- def create_security_group(self, name, **kwargs):
- post_body = {
- 'security_group': {
- 'name': name,
- }
- }
- for key, value in kwargs.iteritems():
- post_body['security_group'][str(key)] = value
- body = json.dumps(post_body)
- uri = '%s/security-groups' % (self.uri_prefix)
- resp, body = self.post(uri, body)
- body = json.loads(body)
- return resp, body
-
def update_floating_ip(self, floating_ip_id, **kwargs):
post_body = {
'floatingip': kwargs}
@@ -177,22 +163,6 @@
body = json.loads(body)
return resp, body
- def create_security_group_rule(self, secgroup_id,
- direction='ingress', **kwargs):
- post_body = {
- 'security_group_rule': {
- 'direction': direction,
- 'security_group_id': secgroup_id
- }
- }
- for key, value in kwargs.iteritems():
- post_body['security_group_rule'][str(key)] = value
- body = json.dumps(post_body)
- uri = '%s/security-group-rules' % (self.uri_prefix)
- resp, body = self.post(uri, body)
- body = json.loads(body)
- return resp, body
-
def create_member(self, address, protocol_port, pool_id):
post_body = {
"member": {
diff --git a/tempest/services/network/xml/network_client.py b/tempest/services/network/xml/network_client.py
index 25e6edb..c520018 100644
--- a/tempest/services/network/xml/network_client.py
+++ b/tempest/services/network/xml/network_client.py
@@ -30,12 +30,6 @@
rc.TYPE = self.TYPE
return rc
- def _parse_array(self, node):
- array = []
- for child in node.getchildren():
- array.append(common.xml_to_json(child))
- return array
-
def deserialize_list(self, body):
return common.parse_array(etree.fromstring(body), self.PLURALS)
@@ -88,30 +82,6 @@
else:
return common.Element(name, value)
- def create_security_group(self, name):
- uri = '%s/security-groups' % (self.uri_prefix)
- post_body = common.Element("security_group")
- p2 = common.Element("name", name)
- post_body.append(p2)
- resp, body = self.post(uri, str(common.Document(post_body)))
- body = _root_tag_fetcher_and_xml_to_json_parse(body)
- return resp, body
-
- def create_security_group_rule(self, secgroup_id,
- direction='ingress', **kwargs):
- uri = '%s/security-group-rules' % (self.uri_prefix)
- rule = common.Element("security_group_rule")
- p1 = common.Element('security_group_id', secgroup_id)
- p2 = common.Element('direction', direction)
- rule.append(p1)
- rule.append(p2)
- for key, val in kwargs.items():
- key = common.Element(key, val)
- rule.append(key)
- resp, body = self.post(uri, str(common.Document(rule)))
- body = _root_tag_fetcher_and_xml_to_json_parse(body)
- return resp, body
-
def create_member(self, address, protocol_port, pool_id):
uri = '%s/lb/members' % (self.uri_prefix)
post_body = common.Element("member")
diff --git a/tempest/test.py b/tempest/test.py
index 22aa3f2..c6e3d6e 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -23,7 +23,6 @@
import uuid
import fixtures
-import nose.plugins.attrib
import testresources
import testtools
@@ -43,11 +42,10 @@
def attr(*args, **kwargs):
- """A decorator which applies the nose and testtools attr decorator
+ """A decorator which applies the testtools attr decorator
- This decorator applies the nose attr decorator as well as the
- the testtools.testcase.attr if it is in the list of attributes
- to testtools we want to apply.
+ This decorator applies the testtools.testcase.attr if it is in the list of
+ attributes to testtools we want to apply.
"""
def decorator(f):
@@ -60,7 +58,7 @@
f = testtools.testcase.attr(attr)(f)
if attr == 'smoke':
f = testtools.testcase.attr('gate')(f)
- return nose.plugins.attrib.attr(*args, **kwargs)(f)
+ return f
return decorator
@@ -194,40 +192,6 @@
return True
return False
-# there is a mis-match between nose and testtools for older pythons.
-# testtools will set skipException to be either
-# unittest.case.SkipTest, unittest2.case.SkipTest or an internal skip
-# exception, depending on what it can find. Python <2.7 doesn't have
-# unittest.case.SkipTest; so if unittest2 is not installed it falls
-# back to the internal class.
-#
-# The current nose skip plugin will decide to raise either
-# unittest.case.SkipTest or its own internal exception; it does not
-# look for unittest2 or the internal unittest exception. Thus we must
-# monkey-patch testtools.TestCase.skipException to be the exception
-# the nose skip plugin expects.
-#
-# However, with the switch to testr nose may not be available, so we
-# require you to opt-in to this fix with an environment variable.
-#
-# This is temporary until upstream nose starts looking for unittest2
-# as testtools does; we can then remove this and ensure unittest2 is
-# available for older pythons; then nose and testtools will agree
-# unittest2.case.SkipTest is the one-true skip test exception.
-#
-# https://review.openstack.org/#/c/33056
-# https://github.com/nose-devs/nose/pull/699
-if 'TEMPEST_PY26_NOSE_COMPAT' in os.environ:
- try:
- import unittest.case.SkipTest
- # convince pep8 we're using the import...
- if unittest.case.SkipTest:
- pass
- raise RuntimeError("You have unittest.case.SkipTest; "
- "no need to override")
- except ImportError:
- LOG.info("Overriding skipException to nose SkipTest")
- testtools.TestCase.skipException = nose.plugins.skip.SkipTest
at_exit_set = set()
diff --git a/tempest/tests/fake_config.py b/tempest/tests/fake_config.py
index 42237ca..41b0558 100644
--- a/tempest/tests/fake_config.py
+++ b/tempest/tests/fake_config.py
@@ -21,6 +21,9 @@
class fake_identity(object):
disable_ssl_certificate_validation = True
+ catalog_type = 'identity'
+ uri = 'http://fake_uri.com/auth'
+ uri_v3 = 'http://fake_uri_v3.com/auth'
class fake_default_feature_enabled(object):
api_extensions = ['all']
diff --git a/tempest/tests/fake_http.py b/tempest/tests/fake_http.py
index ac5f765..a09d5ba 100644
--- a/tempest/tests/fake_http.py
+++ b/tempest/tests/fake_http.py
@@ -17,7 +17,7 @@
class fake_httplib2(object):
- def __init__(self, return_type=None):
+ def __init__(self, return_type=None, *args, **kwargs):
self.return_type = return_type
def request(self, uri, method="GET", body=None, headers=None,
diff --git a/tempest/tests/fake_identity.py b/tempest/tests/fake_identity.py
new file mode 100644
index 0000000..ea2bd44
--- /dev/null
+++ b/tempest/tests/fake_identity.py
@@ -0,0 +1,156 @@
+# Copyright 2014 IBM Corp.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+import httplib2
+import json
+
+
+TOKEN = "fake_token"
+ALT_TOKEN = "alt_fake_token"
+
+# Fake Identity v2 constants
+COMPUTE_ENDPOINTS_V2 = {
+ "endpoints": [
+ {
+ "adminURL": "http://fake_url/api/admin",
+ "region": "NoMatchRegion",
+ "internalURL": "http://fake_url/api/internal",
+ "publicURL": "http://fake_url/api/public"
+ },
+ {
+ "adminURL": "http://fake_url/api/admin",
+ "region": "FakeRegion",
+ "internalURL": "http://fake_url/api/internal",
+ "publicURL": "http://fake_url/api/public"
+ },
+ ],
+ "type": "compute",
+ "name": "nova"
+}
+
+CATALOG_V2 = [COMPUTE_ENDPOINTS_V2, ]
+
+ALT_IDENTITY_V2_RESPONSE = {
+ "access": {
+ "token": {
+ "expires": "2020-01-01T00:00:10Z",
+ "id": ALT_TOKEN,
+ "tenant": {
+ "id": "fake_tenant_id"
+ },
+ },
+ "user": {
+ "id": "fake_user_id",
+ },
+ "serviceCatalog": CATALOG_V2,
+ },
+}
+
+IDENTITY_V2_RESPONSE = {
+ "access": {
+ "token": {
+ "expires": "2020-01-01T00:00:10Z",
+ "id": TOKEN,
+ "tenant": {
+ "id": "fake_tenant_id"
+ },
+ },
+ "user": {
+ "id": "fake_user_id",
+ },
+ "serviceCatalog": CATALOG_V2,
+ },
+}
+
+# Fake Identity V3 constants
+COMPUTE_ENDPOINTS_V3 = {
+ "endpoints": [
+ {
+ "id": "fake_service",
+ "interface": "public",
+ "region": "NoMatchRegion",
+ "url": "http://fake_url/v3"
+ },
+ {
+ "id": "another_fake_service",
+ "interface": "public",
+ "region": "FakeRegion",
+ "url": "http://fake_url/v3"
+ }
+ ],
+ "type": "compute",
+ "id": "fake_compute_endpoint"
+}
+
+CATALOG_V3 = [COMPUTE_ENDPOINTS_V3, ]
+
+IDENTITY_V3_RESPONSE = {
+ "token": {
+ "methods": [
+ "token",
+ "password"
+ ],
+ "expires_at": "2020-01-01T00:00:10.000123Z",
+ "project": {
+ "domain": {
+ "id": "fake_id",
+ "name": "fake"
+ },
+ "id": "project_id",
+ "name": "project_name"
+ },
+ "user": {
+ "domain": {
+ "id": "domain_id",
+ "name": "domain_name"
+ },
+ "id": "fake_user_id",
+ "name": "username"
+ },
+ "issued_at": "2013-05-29T16:55:21.468960Z",
+ "catalog": CATALOG_V3
+ }
+}
+
+ALT_IDENTITY_V3 = IDENTITY_V3_RESPONSE
+
+
+def _fake_v3_response(self, uri, method="GET", body=None, headers=None,
+ redirections=5, connection_type=None):
+ fake_headers = {
+ "status": "201",
+ "x-subject-token": TOKEN
+ }
+ return (httplib2.Response(fake_headers),
+ json.dumps(IDENTITY_V3_RESPONSE))
+
+
+def _fake_v2_response(self, uri, method="GET", body=None, headers=None,
+ redirections=5, connection_type=None):
+ return (httplib2.Response({"status": "200"}),
+ json.dumps(IDENTITY_V2_RESPONSE))
+
+
+def _fake_auth_failure_response():
+ # the response body isn't really used in this case, but lets send it anyway
+ # to have a safe check in some future change on the rest client.
+ body = {
+ "unauthorized": {
+ "message": "Unauthorized",
+ "code": "401"
+ }
+ }
+ return httplib2.Response({"status": "401"}), json.dumps(body)
diff --git a/tempest/tests/files/setup.cfg b/tempest/tests/files/setup.cfg
index 8639baa..f6f9f73 100644
--- a/tempest/tests/files/setup.cfg
+++ b/tempest/tests/files/setup.cfg
@@ -2,8 +2,8 @@
name = tempest_unit_tests
version = 1
summary = Fake Project for testing wrapper scripts
-author = OpenStack QA
-author-email = openstack-qa@lists.openstack.org
+author = OpenStack
+author-email = openstack-dev@lists.openstack.org
home-page = http://www.openstack.org/
classifier =
Intended Audience :: Information Technology
diff --git a/tempest/tests/test_auth.py b/tempest/tests/test_auth.py
new file mode 100644
index 0000000..5346052
--- /dev/null
+++ b/tempest/tests/test_auth.py
@@ -0,0 +1,210 @@
+# Copyright 2014 IBM Corp.
+# 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 copy
+
+from tempest import auth
+from tempest.common import http
+from tempest import config
+from tempest import exceptions
+from tempest.openstack.common.fixture import mockpatch
+from tempest.tests import base
+from tempest.tests import fake_config
+from tempest.tests import fake_http
+from tempest.tests import fake_identity
+
+
+class BaseAuthTestsSetUp(base.TestCase):
+ _auth_provider_class = None
+ credentials = {
+ 'username': 'fake_user',
+ 'password': 'fake_pwd',
+ 'tenant_name': 'fake_tenant'
+ }
+
+ def _auth(self, credentials, **params):
+ """
+ returns auth method according to keystone
+ """
+ return self._auth_provider_class(credentials, **params)
+
+ def setUp(self):
+ super(BaseAuthTestsSetUp, self).setUp()
+ self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakeConfig)
+ self.fake_http = fake_http.fake_httplib2(return_type=200)
+ self.stubs.Set(http.ClosingHttp, 'request', self.fake_http.request)
+ self.auth_provider = self._auth(self.credentials)
+
+
+class TestBaseAuthProvider(BaseAuthTestsSetUp):
+ """
+ This tests auth.AuthProvider class which is base for the other so we
+ obviously don't test not implemented method or the ones which strongly
+ depends on them.
+ """
+ _auth_provider_class = auth.AuthProvider
+
+ def test_check_credentials_is_dict(self):
+ self.assertTrue(self.auth_provider.check_credentials({}))
+
+ def test_check_credentials_bad_type(self):
+ self.assertFalse(self.auth_provider.check_credentials([]))
+
+ def test_instantiate_with_bad_credentials_type(self):
+ """
+ Assure that credentials with bad type fail with TypeError
+ """
+ self.assertRaises(TypeError, self._auth, [])
+
+ def test_auth_data_property(self):
+ self.assertRaises(NotImplementedError, getattr, self.auth_provider,
+ 'auth_data')
+
+ def test_auth_data_property_when_cache_exists(self):
+ self.auth_provider.cache = 'foo'
+ self.useFixture(mockpatch.PatchObject(self.auth_provider,
+ 'is_expired',
+ return_value=False))
+ self.assertEqual('foo', getattr(self.auth_provider, 'auth_data'))
+
+ def test_delete_auth_data_property_through_deleter(self):
+ self.auth_provider.cache = 'foo'
+ del self.auth_provider.auth_data
+ self.assertIsNone(self.auth_provider.cache)
+
+ def test_delete_auth_data_property_through_clear_auth(self):
+ self.auth_provider.cache = 'foo'
+ self.auth_provider.clear_auth()
+ self.assertIsNone(self.auth_provider.cache)
+
+ def test_set_and_reset_alt_auth_data(self):
+ self.auth_provider.set_alt_auth_data('foo', 'bar')
+ self.assertEqual(self.auth_provider.alt_part, 'foo')
+ self.assertEqual(self.auth_provider.alt_auth_data, 'bar')
+
+ self.auth_provider.reset_alt_auth_data()
+ self.assertIsNone(self.auth_provider.alt_part)
+ self.assertIsNone(self.auth_provider.alt_auth_data)
+
+
+class TestKeystoneV2AuthProvider(BaseAuthTestsSetUp):
+ _auth_provider_class = auth.KeystoneV2AuthProvider
+
+ def setUp(self):
+ super(TestKeystoneV2AuthProvider, self).setUp()
+ self.stubs.Set(http.ClosingHttp, 'request',
+ fake_identity._fake_v2_response)
+ self.target_url = 'test_api'
+
+ def _get_fake_alt_identity(self):
+ return fake_identity.ALT_IDENTITY_V2_RESPONSE['access']
+
+ def _get_result_url_from_fake_identity(self):
+ return fake_identity.COMPUTE_ENDPOINTS_V2['endpoints'][1]['publicURL']
+
+ def _get_token_from_fake_identity(self):
+ return fake_identity.TOKEN
+
+ def _test_request_helper(self):
+ filters = {
+ 'service': 'compute',
+ 'endpoint_type': 'publicURL',
+ 'region': 'fakeRegion'
+ }
+
+ url, headers, body = self.auth_provider.auth_request('GET',
+ self.target_url,
+ filters=filters)
+
+ result_url = self._get_result_url_from_fake_identity()
+ self.assertEqual(url, result_url + '/' + self.target_url)
+ self.assertEqual(self._get_token_from_fake_identity(),
+ headers['X-Auth-Token'])
+ self.assertEqual(body, None)
+
+ def test_request(self):
+ self._test_request_helper()
+
+ def test_request_with_alt_auth(self):
+ self.auth_provider.set_alt_auth_data(
+ 'body',
+ (fake_identity.ALT_TOKEN, self._get_fake_alt_identity()))
+ self._test_request_helper()
+ # Assert alt auth data is clear after it
+ self.assertIsNone(self.auth_provider.alt_part)
+ self.assertIsNone(self.auth_provider.alt_auth_data)
+
+ def test_request_with_bad_service(self):
+ filters = {
+ 'service': 'BAD_SERVICE',
+ 'endpoint_type': 'publicURL',
+ 'region': 'fakeRegion'
+ }
+ self.assertRaises(exceptions.EndpointNotFound,
+ self.auth_provider.auth_request, 'GET',
+ 'http://fakeurl.com/fake_api', filters=filters)
+
+ def test_request_without_service(self):
+ filters = {
+ 'service': None,
+ 'endpoint_type': 'publicURL',
+ 'region': 'fakeRegion'
+ }
+ self.assertRaises(exceptions.EndpointNotFound,
+ self.auth_provider.auth_request, 'GET',
+ 'http://fakeurl.com/fake_api', filters=filters)
+
+ def test_check_credentials_missing_attribute(self):
+ for attr in ['username', 'password']:
+ cred = copy.copy(self.credentials)
+ del cred[attr]
+ self.assertFalse(self.auth_provider.check_credentials(cred))
+
+ def test_check_credentials_not_scoped_missing_tenant_name(self):
+ cred = copy.copy(self.credentials)
+ del cred['tenant_name']
+ self.assertTrue(self.auth_provider.check_credentials(cred,
+ scoped=False))
+
+ def test_check_credentials_missing_tenant_name(self):
+ cred = copy.copy(self.credentials)
+ del cred['tenant_name']
+ self.assertFalse(self.auth_provider.check_credentials(cred))
+
+
+class TestKeystoneV3AuthProvider(TestKeystoneV2AuthProvider):
+ _auth_provider_class = auth.KeystoneV3AuthProvider
+ credentials = {
+ 'username': 'fake_user',
+ 'password': 'fake_pwd',
+ 'tenant_name': 'fake_tenant',
+ 'domain_name': 'fake_domain_name',
+ }
+
+ def setUp(self):
+ super(TestKeystoneV3AuthProvider, self).setUp()
+ self.stubs.Set(http.ClosingHttp, 'request',
+ fake_identity._fake_v3_response)
+
+ def _get_fake_alt_identity(self):
+ return fake_identity.ALT_IDENTITY_V3['token']
+
+ def _get_result_url_from_fake_identity(self):
+ return fake_identity.COMPUTE_ENDPOINTS_V3['endpoints'][1]['url']
+
+ def test_check_credentials_missing_tenant_name(self):
+ cred = copy.copy(self.credentials)
+ del cred['domain_name']
+ self.assertFalse(self.auth_provider.check_credentials(cred))
diff --git a/tempest/tests/test_decorators.py b/tempest/tests/test_decorators.py
index 88920dc..aa3c8fc 100644
--- a/tempest/tests/test_decorators.py
+++ b/tempest/tests/test_decorators.py
@@ -41,10 +41,6 @@
self.assertEqual(getattr(foo, '__testtools_attrs'),
set(expected_attrs))
- # nose sets it anyway
- for arg, value in decorator_args.items():
- self.assertEqual(getattr(foo, arg), value)
-
def test_attr_without_type(self):
self._test_attr_helper(expected_attrs='baz', bar='baz')
@@ -74,7 +70,6 @@
t = TestFoo('test_bar')
self.assertEqual(set(decorator_args), getattr(t.test_bar,
'__testtools_attrs'))
- self.assertEqual(list(decorator_args), t.test_bar.type)
self.assertEqual(t.test_bar(), 0)
def test_services_decorator_with_single_service(self):
@@ -110,7 +105,6 @@
expected_frequency)
self.assertEqual(getattr(foo, 'st_allow_inheritance'),
expected_inheritance)
- self.assertEqual(foo.type, 'stress')
self.assertEqual(set(['stress']), getattr(foo, '__testtools_attrs'))
def test_stresstest_decorator_default(self):
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index b36e8c7..6a9836b 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -26,14 +26,12 @@
import keystoneclient.exceptions
import tempest.clients
-from tempest.common.utils.file_utils import have_effective_read_access
+from tempest.common.utils import file_utils
from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
import tempest.test
-from tempest.thirdparty.boto.utils.wait import re_search_wait
-from tempest.thirdparty.boto.utils.wait import state_wait
-from tempest.thirdparty.boto.utils.wait import wait_exception
+from tempest.thirdparty.boto.utils import wait
CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -47,7 +45,7 @@
id_matcher = re.compile("[A-Za-z0-9]{20,}")
def all_read(*args):
- return all(map(have_effective_read_access, args))
+ return all(map(file_utils.have_effective_read_access, args))
materials_path = CONF.boto.s3_materials_path
ami_path = materials_path + os.sep + CONF.boto.ami_manifest
@@ -327,7 +325,7 @@
final_set = set((final_set,))
final_set |= self.gone_set
lfunction = self.get_lfunction_gone(lfunction)
- state = state_wait(lfunction, final_set, valid_set)
+ state = wait.state_wait(lfunction, final_set, valid_set)
self.assertIn(state, valid_set | self.gone_set)
return state
@@ -377,8 +375,8 @@
return "ASSOCIATED"
return "DISASSOCIATED"
- state = state_wait(_disassociate, "DISASSOCIATED",
- set(("ASSOCIATED", "DISASSOCIATED")))
+ state = wait.state_wait(_disassociate, "DISASSOCIATED",
+ set(("ASSOCIATED", "DISASSOCIATED")))
self.assertEqual(state, "DISASSOCIATED")
def assertAddressReleasedWait(self, address):
@@ -391,7 +389,7 @@
return "DELETED"
return "NOTDELETED"
- state = state_wait(_address_delete, "DELETED")
+ state = wait.state_wait(_address_delete, "DELETED")
self.assertEqual(state, "DELETED")
def assertReSearch(self, regexp, string):
@@ -462,7 +460,7 @@
for instance in reservation.instances:
try:
instance.terminate()
- re_search_wait(_instance_state, "_GONE")
+ wait.re_search_wait(_instance_state, "_GONE")
except BaseException:
LOG.exception("Failed to terminate instance %s " % instance)
exc_num += 1
@@ -503,7 +501,8 @@
return volume.status
try:
- re_search_wait(_volume_state, "available") # not validates status
+ wait.re_search_wait(_volume_state, "available")
+ # not validates status
LOG.info(_volume_state())
volume.delete()
except BaseException:
@@ -520,7 +519,7 @@
def _update():
snapshot.update(validate=True)
- wait_exception(_update)
+ wait.wait_exception(_update)
# you can specify tuples if you want to specify the status pattern
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index 54861be..bbfbb79 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -16,23 +16,21 @@
from boto import exception
from tempest.common.utils import data_utils
-from tempest.common.utils.linux.remote_client import RemoteClient
+from tempest.common.utils.linux import remote_client
from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
-from tempest.test import attr
-from tempest.test import skip_because
-from tempest.thirdparty.boto.test import BotoTestCase
-from tempest.thirdparty.boto.utils.s3 import s3_upload_dir
-from tempest.thirdparty.boto.utils.wait import re_search_wait
-from tempest.thirdparty.boto.utils.wait import state_wait
+from tempest import test
+from tempest.thirdparty.boto import test as boto_test
+from tempest.thirdparty.boto.utils import s3
+from tempest.thirdparty.boto.utils import wait
CONF = config.CONF
LOG = logging.getLogger(__name__)
-class InstanceRunTest(BotoTestCase):
+class InstanceRunTest(boto_test.BotoTestCase):
@classmethod
def setUpClass(cls):
@@ -57,7 +55,7 @@
cls.addResourceCleanUp(cls.destroy_bucket,
cls.s3_client.connection_data,
cls.bucket_name)
- s3_upload_dir(bucket, cls.materials_path)
+ s3.s3_upload_dir(bucket, cls.materials_path)
cls.images = {"ami":
{"name": data_utils.rand_name("ami-name-"),
"location": cls.bucket_name + "/" + ami_manifest},
@@ -78,14 +76,14 @@
def _state():
retr = cls.ec2_client.get_image(image["image_id"])
return retr.state
- state = state_wait(_state, "available")
+ state = wait.state_wait(_state, "available")
if state != "available":
for _image in cls.images.itervalues():
cls.ec2_client.deregister_image(_image["image_id"])
raise exceptions.EC2RegisterImageException(image_id=
image["image_id"])
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_run_idempotent_instances(self):
# EC2 run instances idempotently
@@ -123,7 +121,7 @@
_terminate_reservation(reservation_1, rcuk_1)
_terminate_reservation(reservation_2, rcuk_2)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_run_stop_terminate_instance(self):
# EC2 run, stop and terminate instance
image_ami = self.ec2_client.get_image(self.images["ami"]
@@ -148,7 +146,7 @@
instance.terminate()
self.cancelResourceCleanUp(rcuk)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_run_stop_terminate_instance_with_tags(self):
# EC2 run, stop and terminate instance with tags
image_ami = self.ec2_client.get_image(self.images["ami"]
@@ -195,8 +193,8 @@
instance.terminate()
self.cancelResourceCleanUp(rcuk)
- @skip_because(bug="1098891")
- @attr(type='smoke')
+ @test.skip_because(bug="1098891")
+ @test.attr(type='smoke')
def test_run_terminate_instance(self):
# EC2 run, terminate immediately
image_ami = self.ec2_client.get_image(self.images["ami"]
@@ -222,8 +220,8 @@
# NOTE(afazekas): doctored test case,
# with normal validation it would fail
- @skip_because(bug="1182679")
- @attr(type='smoke')
+ @test.skip_because(bug="1182679")
+ @test.attr(type='smoke')
def test_integration_1(self):
# EC2 1. integration test (not strict)
image_ami = self.ec2_client.get_image(self.images["ami"]["image_id"])
@@ -271,9 +269,9 @@
self.assertVolumeStatusWait(volume, "available")
# NOTE(afazekas): it may be reports available before it is available
- ssh = RemoteClient(address.public_ip,
- CONF.compute.ssh_user,
- pkey=self.keypair.material)
+ ssh = remote_client.RemoteClient(address.public_ip,
+ CONF.compute.ssh_user,
+ pkey=self.keypair.material)
text = data_utils.rand_name("Pattern text for console output -")
resp = ssh.write_to_console(text)
self.assertFalse(resp)
@@ -282,7 +280,7 @@
output = instance.get_console_output()
return output.output
- re_search_wait(_output, text)
+ wait.re_search_wait(_output, text)
part_lines = ssh.get_partitions().split('\n')
volume.attach(instance.id, "/dev/vdh")
@@ -291,7 +289,7 @@
return volume.status
self.assertVolumeStatusWait(_volume_state, "in-use")
- re_search_wait(_volume_state, "in-use")
+ wait.re_search_wait(_volume_state, "in-use")
# NOTE(afazekas): Different Hypervisor backends names
# differently the devices,
@@ -305,7 +303,7 @@
return 'DECREASE'
return 'EQUAL'
- state_wait(_part_state, 'INCREASE')
+ wait.state_wait(_part_state, 'INCREASE')
part_lines = ssh.get_partitions().split('\n')
# TODO(afazekas): Resource compare to the flavor settings
@@ -313,10 +311,10 @@
volume.detach()
self.assertVolumeStatusWait(_volume_state, "available")
- re_search_wait(_volume_state, "available")
+ wait.re_search_wait(_volume_state, "available")
LOG.info("Volume %s state: %s", volume.id, volume.status)
- state_wait(_part_state, 'DECREASE')
+ wait.state_wait(_part_state, 'DECREASE')
instance.stop()
address.disassociate()
diff --git a/tempest/thirdparty/boto/test_ec2_keys.py b/tempest/thirdparty/boto/test_ec2_keys.py
index 329ace3..37484cf 100644
--- a/tempest/thirdparty/boto/test_ec2_keys.py
+++ b/tempest/thirdparty/boto/test_ec2_keys.py
@@ -14,9 +14,8 @@
# under the License.
from tempest.common.utils import data_utils
-from tempest.test import attr
-from tempest.test import skip_because
-from tempest.thirdparty.boto.test import BotoTestCase
+from tempest import test
+from tempest.thirdparty.boto import test as boto_test
def compare_key_pairs(a, b):
@@ -24,7 +23,7 @@
a.fingerprint == b.fingerprint)
-class EC2KeysTest(BotoTestCase):
+class EC2KeysTest(boto_test.BotoTestCase):
@classmethod
def setUpClass(cls):
@@ -33,7 +32,7 @@
cls.ec = cls.ec2_error_code
# TODO(afazekas): merge create, delete, get test cases
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_ec2_keypair(self):
# EC2 create KeyPair
key_name = data_utils.rand_name("keypair-")
@@ -42,8 +41,8 @@
self.assertTrue(compare_key_pairs(keypair,
self.client.get_key_pair(key_name)))
- @skip_because(bug="1072318")
- @attr(type='smoke')
+ @test.skip_because(bug="1072318")
+ @test.attr(type='smoke')
def test_delete_ec2_keypair(self):
# EC2 delete KeyPair
key_name = data_utils.rand_name("keypair-")
@@ -51,7 +50,7 @@
self.client.delete_key_pair(key_name)
self.assertEqual(None, self.client.get_key_pair(key_name))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_get_ec2_keypair(self):
# EC2 get KeyPair
key_name = data_utils.rand_name("keypair-")
@@ -60,7 +59,7 @@
self.assertTrue(compare_key_pairs(keypair,
self.client.get_key_pair(key_name)))
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_duplicate_ec2_keypair(self):
# EC2 duplicate KeyPair
key_name = data_utils.rand_name("keypair-")
diff --git a/tempest/thirdparty/boto/test_ec2_network.py b/tempest/thirdparty/boto/test_ec2_network.py
index 4b2f01f..d508c07 100644
--- a/tempest/thirdparty/boto/test_ec2_network.py
+++ b/tempest/thirdparty/boto/test_ec2_network.py
@@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.test import attr
-from tempest.test import skip_because
-from tempest.thirdparty.boto.test import BotoTestCase
+from tempest import test
+from tempest.thirdparty.boto import test as boto_test
-class EC2NetworkTest(BotoTestCase):
+class EC2NetworkTest(boto_test.BotoTestCase):
@classmethod
def setUpClass(cls):
@@ -26,8 +25,8 @@
cls.client = cls.os.ec2api_client
# Note(afazekas): these tests for things duable without an instance
- @skip_because(bug="1080406")
- @attr(type='smoke')
+ @test.skip_because(bug="1080406")
+ @test.attr(type='smoke')
def test_disassociate_not_associated_floating_ip(self):
# EC2 disassociate not associated floating ip
ec2_codes = self.ec2_error_code
diff --git a/tempest/thirdparty/boto/test_ec2_security_groups.py b/tempest/thirdparty/boto/test_ec2_security_groups.py
index 9b58603..86140ec 100644
--- a/tempest/thirdparty/boto/test_ec2_security_groups.py
+++ b/tempest/thirdparty/boto/test_ec2_security_groups.py
@@ -14,18 +14,18 @@
# under the License.
from tempest.common.utils import data_utils
-from tempest.test import attr
-from tempest.thirdparty.boto.test import BotoTestCase
+from tempest import test
+from tempest.thirdparty.boto import test as boto_test
-class EC2SecurityGroupTest(BotoTestCase):
+class EC2SecurityGroupTest(boto_test.BotoTestCase):
@classmethod
def setUpClass(cls):
super(EC2SecurityGroupTest, cls).setUpClass()
cls.client = cls.os.ec2api_client
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_authorize_security_group(self):
# EC2 Create, authorize/revoke security group
group_name = data_utils.rand_name("securty_group-")
diff --git a/tempest/thirdparty/boto/test_ec2_volumes.py b/tempest/thirdparty/boto/test_ec2_volumes.py
index 04671c5..6a771e5 100644
--- a/tempest/thirdparty/boto/test_ec2_volumes.py
+++ b/tempest/thirdparty/boto/test_ec2_volumes.py
@@ -13,10 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest import config
from tempest.openstack.common import log as logging
-from tempest.test import attr
-from tempest.thirdparty.boto.test import BotoTestCase
+from tempest import test
+from tempest.thirdparty.boto import test as boto_test
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -25,15 +27,20 @@
a.size == b.size)
-class EC2VolumesTest(BotoTestCase):
+class EC2VolumesTest(boto_test.BotoTestCase):
@classmethod
def setUpClass(cls):
super(EC2VolumesTest, cls).setUpClass()
+
+ if not CONF.service_available.cinder:
+ skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
+ raise cls.skipException(skip_msg)
+
cls.client = cls.os.ec2api_client
cls.zone = cls.client.get_good_zone()
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_get_delete(self):
# EC2 Create, get, delete Volume
volume = self.client.create_volume(1, self.zone)
@@ -46,7 +53,7 @@
self.client.delete_volume(volume.id)
self.cancelResourceCleanUp(cuk)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_volume_from_snapshot(self):
# EC2 Create volume from snapshot
volume = self.client.create_volume(1, self.zone)
diff --git a/tempest/thirdparty/boto/test_s3_buckets.py b/tempest/thirdparty/boto/test_s3_buckets.py
index f34faac..af6aa8b 100644
--- a/tempest/thirdparty/boto/test_s3_buckets.py
+++ b/tempest/thirdparty/boto/test_s3_buckets.py
@@ -14,20 +14,19 @@
# under the License.
from tempest.common.utils import data_utils
-from tempest.test import attr
-from tempest.test import skip_because
-from tempest.thirdparty.boto.test import BotoTestCase
+from tempest import test
+from tempest.thirdparty.boto import test as boto_test
-class S3BucketsTest(BotoTestCase):
+class S3BucketsTest(boto_test.BotoTestCase):
@classmethod
def setUpClass(cls):
super(S3BucketsTest, cls).setUpClass()
cls.client = cls.os.s3_client
- @skip_because(bug="1076965")
- @attr(type='smoke')
+ @test.skip_because(bug="1076965")
+ @test.attr(type='smoke')
def test_create_and_get_delete_bucket(self):
# S3 Create, get and delete bucket
bucket_name = data_utils.rand_name("s3bucket-")
diff --git a/tempest/thirdparty/boto/test_s3_ec2_images.py b/tempest/thirdparty/boto/test_s3_ec2_images.py
index 9607a92..d2300ee 100644
--- a/tempest/thirdparty/boto/test_s3_ec2_images.py
+++ b/tempest/thirdparty/boto/test_s3_ec2_images.py
@@ -17,14 +17,14 @@
from tempest.common.utils import data_utils
from tempest import config
-from tempest.test import attr
-from tempest.thirdparty.boto.test import BotoTestCase
-from tempest.thirdparty.boto.utils.s3 import s3_upload_dir
+from tempest import test
+from tempest.thirdparty.boto import test as boto_test
+from tempest.thirdparty.boto.utils import s3
CONF = config.CONF
-class S3ImagesTest(BotoTestCase):
+class S3ImagesTest(boto_test.BotoTestCase):
@classmethod
def setUpClass(cls):
@@ -46,9 +46,9 @@
cls.addResourceCleanUp(cls.destroy_bucket,
cls.s3_client.connection_data,
cls.bucket_name)
- s3_upload_dir(bucket, cls.materials_path)
+ s3.s3_upload_dir(bucket, cls.materials_path)
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_register_get_deregister_ami_image(self):
# Register and deregister ami image
image = {"name": data_utils.rand_name("ami-name-"),
diff --git a/tempest/thirdparty/boto/test_s3_objects.py b/tempest/thirdparty/boto/test_s3_objects.py
index a102a22..1ae46de 100644
--- a/tempest/thirdparty/boto/test_s3_objects.py
+++ b/tempest/thirdparty/boto/test_s3_objects.py
@@ -18,18 +18,18 @@
import boto.s3.key
from tempest.common.utils import data_utils
-from tempest.test import attr
-from tempest.thirdparty.boto.test import BotoTestCase
+from tempest import test
+from tempest.thirdparty.boto import test as boto_test
-class S3BucketsTest(BotoTestCase):
+class S3BucketsTest(boto_test.BotoTestCase):
@classmethod
def setUpClass(cls):
super(S3BucketsTest, cls).setUpClass()
cls.client = cls.os.s3_client
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_create_get_delete_object(self):
# S3 Create, get and delete object
bucket_name = data_utils.rand_name("s3bucket-")
diff --git a/tempest/thirdparty/boto/utils/wait.py b/tempest/thirdparty/boto/utils/wait.py
index eed0a92..752ed0f 100644
--- a/tempest/thirdparty/boto/utils/wait.py
+++ b/tempest/thirdparty/boto/utils/wait.py
@@ -17,7 +17,7 @@
import time
import boto.exception
-from testtools import TestCase
+import testtools
from tempest import config
from tempest.openstack.common import log as logging
@@ -44,10 +44,11 @@
return status
dtime = time.time() - start_time
if dtime > CONF.boto.build_timeout:
- raise TestCase.failureException("State change timeout exceeded!"
- '(%ds) While waiting'
- 'for %s at "%s"' %
- (dtime, final_set, status))
+ raise testtools.TestCase\
+ .failureException("State change timeout exceeded!"
+ '(%ds) While waiting'
+ 'for %s at "%s"' %
+ (dtime, final_set, status))
time.sleep(CONF.boto.build_interval)
old_status = status
status = lfunction()
@@ -67,10 +68,11 @@
return result
dtime = time.time() - start_time
if dtime > CONF.boto.build_timeout:
- raise TestCase.failureException('Pattern find timeout exceeded!'
- '(%ds) While waiting for'
- '"%s" pattern in "%s"' %
- (dtime, regexp, text))
+ raise testtools.TestCase\
+ .failureException('Pattern find timeout exceeded!'
+ '(%ds) While waiting for'
+ '"%s" pattern in "%s"' %
+ (dtime, regexp, text))
time.sleep(CONF.boto.build_interval)
@@ -98,8 +100,8 @@
# Let the other exceptions propagate
dtime = time.time() - start_time
if dtime > CONF.boto.build_timeout:
- raise TestCase.failureException("Wait timeout exceeded! (%ds)" %
- dtime)
+ raise testtools.TestCase\
+ .failureException("Wait timeout exceeded! (%ds)" % dtime)
time.sleep(CONF.boto.build_interval)
@@ -116,8 +118,8 @@
return exc
dtime = time.time() - start_time
if dtime > CONF.boto.build_timeout:
- raise TestCase.failureException("Wait timeout exceeded! (%ds)" %
- dtime)
+ raise testtools.TestCase\
+ .failureException("Wait timeout exceeded! (%ds)" % dtime)
time.sleep(CONF.boto.build_interval)
# TODO(afazekas): consider strategy design pattern..
diff --git a/tox.ini b/tox.ini
index 1580b14..69e9d57 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,11 +4,10 @@
skipsdist = True
[testenv]
-sitepackages = True
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=./tempest/test_discover
usedevelop = True
-install_command = pip install {opts} {packages}
+install_command = pip install -U {opts} {packages}
[testenv:py26]
setenv = OS_TEST_PATH=./tempest/tests
@@ -27,11 +26,13 @@
commands = python setup.py testr --coverage --testr-arg='tempest\.tests {posargs}'
[testenv:all]
+sitepackages = True
setenv = VIRTUAL_ENV={envdir}
commands =
python setup.py testr --slowest --testr-args='{posargs}'
[testenv:full]
+sitepackages = True
# The regex below is used to select which tests to run and exclude the slow tag:
# See the testrepostiory bug: https://bugs.launchpad.net/testrepository/+bug/1208610
commands =
@@ -44,49 +45,29 @@
bash tools/pretty_tox_serial.sh '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|thirdparty|cli)) {posargs}'
[testenv:testr-full]
+sitepackages = True
commands =
bash tools/pretty_tox.sh '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|thirdparty|cli)) {posargs}'
[testenv:heat-slow]
+sitepackages = True
setenv = OS_TEST_TIMEOUT=1200
# The regex below is used to select heat api/scenario tests tagged as slow.
commands =
bash tools/pretty_tox_serial.sh '(?=.*\[.*\bslow\b.*\])(^tempest\.(api|scenario)\.orchestration) {posargs}'
[testenv:large-ops]
+sitepackages = True
commands =
python setup.py testr --slowest --testr-args='tempest.scenario.test_large_ops {posargs}'
-
-[testenv:py26-full]
-setenv = VIRTUAL_ENV={envdir}
- NOSE_WITH_OPENSTACK=1
- NOSE_OPENSTACK_COLOR=1
- NOSE_OPENSTACK_RED=15
- NOSE_OPENSTACK_YELLOW=3
- NOSE_OPENSTACK_SHOW_ELAPSED=1
- NOSE_OPENSTACK_STDOUT=1
- TEMPEST_PY26_NOSE_COMPAT=1
-commands =
- nosetests --logging-format '%(asctime)-15s %(message)s' --with-xunit -sv --xunit-file=nosetests-full.xml tempest/api tempest/scenario tempest/thirdparty tempest/cli {posargs}
-
-[testenv:py26-smoke]
-setenv = VIRTUAL_ENV={envdir}
-NOSE_WITH_OPENSTACK=1
- NOSE_OPENSTACK_COLOR=1
- NOSE_OPENSTACK_RED=15
- NOSE_OPENSTACK_YELLOW=3
- NOSE_OPENSTACK_SHOW_ELAPSED=1
- NOSE_OPENSTACK_STDOUT=1
- TEMPEST_PY26_NOSE_COMPAT=1
-commands =
- nosetests --logging-format '%(asctime)-15s %(message)s' --with-xunit -sv --attr=type=smoke --xunit-file=nosetests-smoke.xml tempest {posargs}
-
[testenv:smoke]
+sitepackages = True
commands =
bash tools/pretty_tox.sh '(?!.*\[.*\bslow\b.*\])((smoke)|(^tempest\.scenario)) {posargs}'
[testenv:smoke-serial]
+sitepackages = True
# This is still serial because neutron doesn't work with parallel. See:
# https://bugs.launchpad.net/tempest/+bug/1216076 so the neutron smoke
# job would fail if we moved it to parallel.
@@ -94,6 +75,7 @@
bash tools/pretty_tox_serial.sh '(?!.*\[.*\bslow\b.*\])((smoke)|(^tempest\.scenario)) {posargs}'
[testenv:stress]
+sitepackages = True
commands =
python -m tempest/stress/run_stress -a -d 3600 -S