Separate the deleting server tests
"Servers should be always delete-able unless they are lock-ed."
This principle is important, and it is better to separate the
tests from current mixed class of this viewpoint to check the
test coverage.
Change-Id: I9df45f3b0c8395c36b586fd31a1526fb87b63389
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
new file mode 100644
index 0000000..488afb6
--- /dev/null
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -0,0 +1,64 @@
+# Copyright 2012 OpenStack Foundation
+# 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 test
+
+
+class DeleteServersTestJSON(base.BaseV2ComputeTest):
+ # NOTE: Server creations of each test class should be under 10
+ # for preventing "Quota exceeded for instances"
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(DeleteServersTestJSON, cls).setUpClass()
+ cls.client = cls.servers_client
+
+ @test.attr(type='gate')
+ def test_delete_server_while_in_building_state(self):
+ # Delete a server while it's VM state is Building
+ resp, server = self.create_test_server(wait_until='BUILD')
+ resp, _ = self.client.delete_server(server['id'])
+ self.assertEqual('204', resp['status'])
+
+ @test.attr(type='gate')
+ def test_delete_active_server(self):
+ # Delete a server while it's VM state is Active
+ resp, server = self.create_test_server(wait_until='ACTIVE')
+ resp, _ = self.client.delete_server(server['id'])
+ self.assertEqual('204', resp['status'])
+
+ @test.attr(type='gate')
+ def test_delete_server_while_in_shutoff_state(self):
+ # Delete a server while it's VM state is Shutoff
+ resp, server = self.create_test_server(wait_until='ACTIVE')
+ resp, body = self.client.stop(server['id'])
+ self.client.wait_for_server_status(server['id'], 'SHUTOFF')
+ resp, _ = self.client.delete_server(server['id'])
+ self.assertEqual('204', resp['status'])
+
+ @test.attr(type='gate')
+ def test_delete_server_while_in_pause_state(self):
+ # Delete a server while it's VM state is Pause
+ resp, server = self.create_test_server(wait_until='ACTIVE')
+ resp, body = self.client.pause_server(server['id'])
+ self.client.wait_for_server_status(server['id'], 'PAUSED')
+ resp, _ = self.client.delete_server(server['id'])
+ self.assertEqual('204', resp['status'])
+
+
+class DeleteServersTestXML(DeleteServersTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index 203832e..7167a8b 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -104,38 +104,6 @@
self.assertEqual('::babe:202:202', server['accessIPv6'])
@attr(type='gate')
- def test_delete_server_while_in_shutoff_state(self):
- # Delete a server while it's VM state is Shutoff
- resp, server = self.create_test_server(wait_until='ACTIVE')
- resp, body = self.client.stop(server['id'])
- self.client.wait_for_server_status(server['id'], 'SHUTOFF')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
-
- @attr(type='gate')
- def test_delete_server_while_in_pause_state(self):
- # Delete a server while it's VM state is Pause
- resp, server = self.create_test_server(wait_until='ACTIVE')
- resp, body = self.client.pause_server(server['id'])
- self.client.wait_for_server_status(server['id'], 'PAUSED')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
-
- @attr(type='gate')
- def test_delete_server_while_in_building_state(self):
- # Delete a server while it's VM state is Building
- resp, server = self.create_test_server(wait_until='BUILD')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
-
- @attr(type='gate')
- def test_delete_active_server(self):
- # Delete a server while it's VM state is Active
- resp, server = self.create_test_server(wait_until='ACTIVE')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
-
- @attr(type='gate')
def test_create_server_with_ipv6_addr_only(self):
# Create a server without an IPv4 address(only IPv6 address).
resp, server = self.create_test_server(accessIPv6='2001:2001::3')
diff --git a/tempest/api/compute/v3/servers/test_delete_server.py b/tempest/api/compute/v3/servers/test_delete_server.py
new file mode 100644
index 0000000..0e62ea4
--- /dev/null
+++ b/tempest/api/compute/v3/servers/test_delete_server.py
@@ -0,0 +1,59 @@
+# Copyright 2012 OpenStack Foundation
+#
+# 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 test
+
+
+class DeleteServersV3Test(base.BaseV3ComputeTest):
+ # NOTE: Server creations of each test class should be under 10
+ # for preventing "Quota exceeded for instances".
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(DeleteServersV3Test, cls).setUpClass()
+ cls.client = cls.servers_client
+
+ @test.attr(type='gate')
+ def test_delete_server_while_in_building_state(self):
+ # Delete a server while it's VM state is Building
+ resp, server = self.create_test_server(wait_until='BUILD')
+ resp, _ = self.client.delete_server(server['id'])
+ self.assertEqual('204', resp['status'])
+
+ @test.attr(type='gate')
+ def test_delete_active_server(self):
+ # Delete a server while it's VM state is Active
+ resp, server = self.create_test_server(wait_until='ACTIVE')
+ resp, _ = self.client.delete_server(server['id'])
+ self.assertEqual('204', resp['status'])
+
+ @test.attr(type='gate')
+ def test_delete_server_while_in_shutoff_state(self):
+ # Delete a server while it's VM state is Shutoff
+ resp, server = self.create_test_server(wait_until='ACTIVE')
+ resp, body = self.client.stop(server['id'])
+ self.client.wait_for_server_status(server['id'], 'SHUTOFF')
+ resp, _ = self.client.delete_server(server['id'])
+ self.assertEqual('204', resp['status'])
+
+ @test.attr(type='gate')
+ def test_delete_server_while_in_pause_state(self):
+ # Delete a server while it's VM state is Pause
+ resp, server = self.create_test_server(wait_until='ACTIVE')
+ resp, body = self.client.pause_server(server['id'])
+ self.client.wait_for_server_status(server['id'], 'PAUSED')
+ resp, _ = self.client.delete_server(server['id'])
+ self.assertEqual('204', resp['status'])
diff --git a/tempest/api/compute/v3/servers/test_servers.py b/tempest/api/compute/v3/servers/test_servers.py
index dc64c40..5480e31 100644
--- a/tempest/api/compute/v3/servers/test_servers.py
+++ b/tempest/api/compute/v3/servers/test_servers.py
@@ -105,38 +105,6 @@
server['os-access-ips:access_ip_v6'])
@test.attr(type='gate')
- def test_delete_server_while_in_shutoff_state(self):
- # Delete a server while it's VM state is Shutoff
- resp, server = self.create_test_server(wait_until='ACTIVE')
- resp, body = self.client.stop(server['id'])
- self.client.wait_for_server_status(server['id'], 'SHUTOFF')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
-
- @test.attr(type='gate')
- def test_delete_server_while_in_pause_state(self):
- # Delete a server while it's VM state is Pause
- resp, server = self.create_test_server(wait_until='ACTIVE')
- resp, body = self.client.pause_server(server['id'])
- self.client.wait_for_server_status(server['id'], 'PAUSED')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
-
- @test.attr(type='gate')
- def test_delete_server_while_in_building_state(self):
- # Delete a server while it's VM state is Building
- resp, server = self.create_test_server(wait_until='BUILD')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
-
- @test.attr(type='gate')
- def test_delete_active_server(self):
- # Delete a server while it's VM state is Active
- resp, server = self.create_test_server(wait_until='ACTIVE')
- resp, _ = self.client.delete_server(server['id'])
- self.assertEqual('204', resp['status'])
-
- @test.attr(type='gate')
def test_create_server_with_ipv6_addr_only(self):
# Create a server without an IPv4 address(only IPv6 address).
resp, server = self.create_test_server(access_ip_v6='2001:2001::3')