enable test_servers_negative
this was disabled when we were seeing flakey fails during Folsom
release, however all but one of these tests current pass. And the
failure is a new nova bug. Pushing to CI to verify that bug on both
databases before providing the fixes to nova (of which there will
be at least 2)
fix xml clients for negative tests
the xml clients were failing additional tests because the clients
didn't support all the features as the json tests. This enables
security_groups and networks in the xml client for create.
It also skips the test_create_numeric_server_name as that can't be
tested in xml, it always turns it into a string.
Fixes bug #1046870
Change-Id: I8a3a0bef9b1d134da369242a0cf14c3dcb61c6de
diff --git a/tempest/services/compute/xml/servers_client.py b/tempest/services/compute/xml/servers_client.py
index efb28e6..903e10c 100644
--- a/tempest/services/compute/xml/servers_client.py
+++ b/tempest/services/compute/xml/servers_client.py
@@ -182,13 +182,13 @@
server = Element("server")
doc.append(server)
- if name:
+ if name is not None:
server.add_attr("name", name)
- if accessIPv4:
+ if accessIPv4 is not None:
server.add_attr("accessIPv4", accessIPv4)
- if accessIPv6:
+ if accessIPv6 is not None:
server.add_attr("accessIPv6", accessIPv6)
- if meta:
+ if meta is not None:
metadata = Element("metadata")
server.append(metadata)
for k, v in meta:
@@ -228,10 +228,26 @@
flavorRef=flavor_ref,
name=name)
- for attr in ["adminPass", "accessIPv4", "accessIPv6", "key_name"]:
+ for attr in ["adminPass", "accessIPv4", "accessIPv6", "key_name",
+ "user_data", "availability_zone"]:
if attr in kwargs:
server.add_attr(attr, kwargs[attr])
+ if 'security_groups' in kwargs:
+ secgroups = Element("security_groups")
+ server.append(secgroups)
+ for secgroup in kwargs['security_groups']:
+ s = Element("security_group", name=secgroup['name'])
+ secgroups.append(s)
+
+ if 'networks' in kwargs:
+ networks = Element("networks")
+ server.append(networks)
+ for network in kwargs['networks']:
+ s = Element("network", uuid=network['uuid'],
+ fixed_ip=network['fixed_ip'])
+ networks.append(s)
+
if 'meta' in kwargs:
metadata = Element("metadata")
server.append(metadata)
diff --git a/tempest/tests/compute/servers/test_servers_negative.py b/tempest/tests/compute/servers/test_servers_negative.py
index 366b630..9013b36 100644
--- a/tempest/tests/compute/servers/test_servers_negative.py
+++ b/tempest/tests/compute/servers/test_servers_negative.py
@@ -29,7 +29,6 @@
@classmethod
def setUpClass(cls):
- raise cls.skipException("Until Bug 1046870 is fixed")
super(ServersNegativeTest, cls).setUpClass()
cls.client = cls.servers_client
cls.img_client = cls.images_client
@@ -115,6 +114,8 @@
@attr(type='negative')
def test_create_numeric_server_name(self):
# Create a server with a numeric name
+ if self.__class__._interface == "xml":
+ raise self.skipException("Not testable in XML")
server_name = 12345
self.assertRaises(exceptions.BadRequest,
@@ -182,7 +183,7 @@
def test_update_server_of_another_tenant(self):
# Update name of a server that belongs to another tenant
- server = self.create_server()
+ resp, server = self.create_server(wait_until='ACTIVE')
new_name = server['id'] + '_new'
self.assertRaises(exceptions.NotFound,
self.alt_client.update_server, server['id'],
@@ -192,7 +193,7 @@
def test_update_server_name_length_exceeds_256(self):
# Update name of server exceed the name length limit
- server = self.create_server()
+ resp, server = self.create_server(wait_until='ACTIVE')
new_name = 'a' * 256
self.assertRaises(exceptions.BadRequest,
self.client.update_server,
@@ -210,7 +211,7 @@
def test_delete_a_server_of_another_tenant(self):
# Delete a server that belongs to another tenant
try:
- server = self.create_server()
+ resp, server = self.create_server(wait_until='ACTIVE')
self.assertRaises(exceptions.NotFound,
self.alt_client.delete_server,
server['id'])
@@ -245,3 +246,7 @@
self.assertRaises(exceptions.NotFound, self.client.get_server,
'999erra43')
+
+
+class ServersNegativeTestXML(ServersNegativeTest):
+ _interface = 'xml'