Merge "VPNaas vpnservice test cases"
diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py
index e744200..757dfc0 100644
--- a/tempest/api/compute/admin/test_quotas.py
+++ b/tempest/api/compute/admin/test_quotas.py
@@ -17,8 +17,10 @@
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
+from tempest import config
from tempest import exceptions
from tempest.test import attr
+from tempest.test import skip_because
class QuotasAdminTestJSON(base.BaseComputeAdminTest):
@@ -158,6 +160,8 @@
instances=default_instances_quota)
self.assertRaises(exceptions.OverLimit, self.create_server)
+ @skip_because(bug="1186354",
+ condition=config.TempestConfig().service_available.neutron)
@attr(type=['negative', 'gate'])
def test_security_groups_exceed_limit(self):
# Negative test: Creation Security Groups over limit should FAIL
@@ -180,6 +184,8 @@
self.sg_client.create_security_group,
"sg-overlimit", "sg-desc")
+ @skip_because(bug="1186354",
+ condition=config.TempestConfig().service_available.neutron)
@attr(type=['negative', 'gate'])
def test_security_groups_rules_exceed_limit(self):
# Negative test: Creation of Security Group Rules should FAIL
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 800b2de..bb04f1d 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -23,9 +23,12 @@
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
+from tempest.openstack.common import log as logging
from tempest.test import attr
from tempest.test import skip_because
+LOG = logging.getLogger(__name__)
+
class ImagesOneServerTestJSON(base.BaseComputeTest):
_interface = 'json'
@@ -37,6 +40,19 @@
self.image_ids.remove(image_id)
super(ImagesOneServerTestJSON, self).tearDown()
+ def setUp(self):
+ # NOTE(afazekas): Normally we use the same server with all test cases,
+ # but if it has an issue, we build a new one
+ super(ImagesOneServerTestJSON, self).setUp()
+ # Check if the server is in a clean state after test
+ try:
+ self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ except Exception as exc:
+ LOG.exception(exc)
+ # Rebuild server if cannot reach the ACTIVE state
+ # Usually it means the server had a serius accident
+ self.rebuild_server()
+
@classmethod
def setUpClass(cls):
super(ImagesOneServerTestJSON, cls).setUpClass()
@@ -46,7 +62,8 @@
raise cls.skipException(skip_msg)
try:
- resp, cls.server = cls.create_server(wait_until='ACTIVE')
+ resp, server = cls.create_server(wait_until='ACTIVE')
+ cls.server_id = server['id']
except Exception:
cls.tearDownClass()
raise
@@ -71,7 +88,7 @@
# Return an error if the image name has multi-byte characters
snapshot_name = rand_name('\xef\xbb\xbf')
self.assertRaises(exceptions.BadRequest,
- self.client.create_image, self.server['id'],
+ self.client.create_image, self.server_id,
snapshot_name)
@attr(type=['negative', 'gate'])
@@ -80,7 +97,7 @@
snapshot_name = rand_name('test-snap-')
meta = {'': ''}
self.assertRaises(exceptions.BadRequest, self.client.create_image,
- self.server['id'], snapshot_name, meta)
+ self.server_id, snapshot_name, meta)
@attr(type=['negative', 'gate'])
def test_create_image_specify_metadata_over_limits(self):
@@ -88,7 +105,7 @@
snapshot_name = rand_name('test-snap-')
meta = {'a' * 260: 'b' * 260}
self.assertRaises(exceptions.BadRequest, self.client.create_image,
- self.server['id'], snapshot_name, meta)
+ self.server_id, snapshot_name, meta)
def _get_default_flavor_disk_size(self, flavor_id):
resp, flavor = self.flavors_client.get_flavor_details(flavor_id)
@@ -102,7 +119,7 @@
# Create a new image
name = rand_name('image')
meta = {'image_type': 'test'}
- resp, body = self.client.create_image(self.server['id'], name, meta)
+ resp, body = self.client.create_image(self.server_id, name, meta)
self.assertEqual(202, resp.status)
image_id = parse_image_id(resp['location'])
self.client.wait_for_image_status(image_id, 'ACTIVE')
@@ -133,7 +150,7 @@
# Create first snapshot
snapshot_name = rand_name('test-snap-')
- resp, body = self.client.create_image(self.server['id'],
+ resp, body = self.client.create_image(self.server_id,
snapshot_name)
self.assertEqual(202, resp.status)
image_id = parse_image_id(resp['location'])
@@ -142,7 +159,7 @@
# Create second snapshot
alt_snapshot_name = rand_name('test-snap-')
self.assertRaises(exceptions.Duplicate, self.client.create_image,
- self.server['id'], alt_snapshot_name)
+ self.server_id, alt_snapshot_name)
self.client.wait_for_image_status(image_id, 'ACTIVE')
@attr(type=['negative', 'gate'])
@@ -151,14 +168,14 @@
snapshot_name = rand_name('a' * 260)
self.assertRaises(exceptions.BadRequest, self.client.create_image,
- self.server['id'], snapshot_name)
+ self.server_id, snapshot_name)
@attr(type=['negative', 'gate'])
def test_delete_image_that_is_not_yet_active(self):
# Return an error while trying to delete an image what is creating
snapshot_name = rand_name('test-snap-')
- resp, body = self.client.create_image(self.server['id'], snapshot_name)
+ resp, body = self.client.create_image(self.server_id, snapshot_name)
self.assertEqual(202, resp.status)
image_id = parse_image_id(resp['location'])
self.image_ids.append(image_id)
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 255beb7..f073ebc 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -197,41 +197,6 @@
required time (%s s).' % (self.server_id, self.build_timeout)
raise exceptions.TimeoutException(message)
- @attr(type=['negative', 'gate'])
- def test_resize_server_using_nonexist_flavor(self):
- flavor_id = -1
- self.assertRaises(exceptions.BadRequest,
- self.client.resize, self.server_id, flavor_id)
-
- @attr(type=['negative', 'gate'])
- def test_resize_server_using_null_flavor(self):
- flavor_id = ""
- self.assertRaises(exceptions.BadRequest,
- self.client.resize, self.server_id, flavor_id)
-
- @attr(type=['negative', 'gate'])
- def test_reboot_nonexistent_server_soft(self):
- # Negative Test: The server reboot on non existent server should return
- # an error
- self.assertRaises(exceptions.NotFound, self.client.reboot, 999, 'SOFT')
-
- @attr(type=['negative', 'gate'])
- def test_rebuild_nonexistent_server(self):
- # Negative test: The server rebuild for a non existing server
- # should not be allowed
- meta = {'rebuild': 'server'}
- new_name = rand_name('server')
- file_contents = 'Test server rebuild.'
- personality = [{'path': '/etc/rebuild.txt',
- 'contents': base64.b64encode(file_contents)}]
- self.assertRaises(exceptions.NotFound,
- self.client.rebuild,
- 999, self.image_ref_alt,
- name=new_name,
- metadata=meta,
- personality=personality,
- adminPass='rebuild')
-
@attr(type='gate')
def test_get_console_output(self):
# Positive test:Should be able to GET the console output
@@ -245,14 +210,6 @@
self.assertEqual(lines, 10)
self.wait_for(get_output)
- @attr(type=['negative', 'gate'])
- def test_get_console_output_invalid_server_id(self):
- # Negative test: Should not be able to get the console output
- # for an invalid server_id
- self.assertRaises(exceptions.NotFound,
- self.servers_client.get_console_output,
- '!@#$%^&*()', 10)
-
@skip_because(bug="1014683")
@attr(type='gate')
def test_get_console_output_server_id_in_reboot_status(self):
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index c896224..7062a3b 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -15,6 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import base64
import sys
import uuid
@@ -99,6 +100,26 @@
self.create_server, accessIPv6=IPv6)
@attr(type=['negative', 'gate'])
+ def test_resize_server_with_non_existent_flavor(self):
+ # Resize a server with non-existent flavor
+ nonexistent_flavor = str(uuid.uuid4())
+ self.assertRaises(exceptions.BadRequest, self.client.resize,
+ self.server_id, flavor_ref=nonexistent_flavor)
+
+ @attr(type=['negative', 'gate'])
+ def test_resize_server_with_null_flavor(self):
+ # Resize a server with null flavor
+ self.assertRaises(exceptions.BadRequest, self.client.resize,
+ self.server_id, flavor_ref="")
+
+ @attr(type=['negative', 'gate'])
+ def test_reboot_non_existent_server(self):
+ # Reboot a non existent server
+ nonexistent_server = str(uuid.uuid4())
+ self.assertRaises(exceptions.NotFound, self.client.reboot,
+ nonexistent_server, 'SOFT')
+
+ @attr(type=['negative', 'gate'])
def test_reboot_deleted_server(self):
# Reboot a deleted server
self.client.delete_server(self.server_id)
@@ -126,6 +147,23 @@
self.server_id, self.image_ref_alt)
@attr(type=['negative', 'gate'])
+ def test_rebuild_non_existent_server(self):
+ # Rebuild a non existent server
+ nonexistent_server = str(uuid.uuid4())
+ meta = {'rebuild': 'server'}
+ new_name = rand_name('server')
+ file_contents = 'Test server rebuild.'
+ personality = [{'path': '/etc/rebuild.txt',
+ 'contents': base64.b64encode(file_contents)}]
+ self.assertRaises(exceptions.NotFound,
+ self.client.rebuild,
+ nonexistent_server,
+ self.image_ref_alt,
+ name=new_name, meta=meta,
+ personality=personality,
+ adminPass='rebuild')
+
+ @attr(type=['negative', 'gate'])
def test_create_numeric_server_name(self):
# Create a server with a numeric name
if self.__class__._interface == "xml":
@@ -258,20 +296,23 @@
@attr(type=['negative', 'gate'])
def test_stop_non_existent_server(self):
# Stop a non existent server
+ nonexistent_server = str(uuid.uuid4())
self.assertRaises(exceptions.NotFound, self.servers_client.stop,
- str(uuid.uuid4()))
+ nonexistent_server)
@attr(type=['negative', 'gate'])
def test_pause_non_existent_server(self):
# pause a non existent server
+ nonexistent_server = str(uuid.uuid4())
self.assertRaises(exceptions.NotFound, self.client.pause_server,
- str(uuid.uuid4()))
+ nonexistent_server)
@attr(type=['negative', 'gate'])
def test_unpause_non_existent_server(self):
# unpause a non existent server
+ nonexistent_server = str(uuid.uuid4())
self.assertRaises(exceptions.NotFound, self.client.unpause_server,
- str(uuid.uuid4()))
+ nonexistent_server)
@attr(type=['negative', 'gate'])
def test_unpause_server_invalid_state(self):
@@ -283,8 +324,9 @@
@attr(type=['negative', 'gate'])
def test_suspend_non_existent_server(self):
# suspend a non existent server
+ nonexistent_server = str(uuid.uuid4())
self.assertRaises(exceptions.NotFound, self.client.suspend_server,
- str(uuid.uuid4()))
+ nonexistent_server)
@attr(type=['negative', 'gate'])
def test_suspend_server_invalid_state(self):
@@ -299,8 +341,9 @@
@attr(type=['negative', 'gate'])
def test_resume_non_existent_server(self):
# resume a non existent server
+ nonexistent_server = str(uuid.uuid4())
self.assertRaises(exceptions.NotFound, self.client.resume_server,
- str(uuid.uuid4()))
+ nonexistent_server)
@attr(type=['negative', 'gate'])
def test_resume_server_invalid_state(self):
@@ -309,6 +352,14 @@
self.client.resume_server,
self.server_id)
+ @attr(type=['negative', 'gate'])
+ def test_get_console_output_of_non_existent_server(self):
+ # get the console output for a non existent server
+ nonexistent_server = str(uuid.uuid4())
+ self.assertRaises(exceptions.NotFound,
+ self.client.get_console_output,
+ nonexistent_server, 10)
+
class ServersNegativeTestXML(ServersNegativeTestJSON):
_interface = 'xml'