Move compute admin test classes under admin path
The moved test classes inherit from an admin test class, and it
would be nice to exist under admin path like the other test classes.
NOTE: These test classes are not used from the other projects which
include Defcore. It is not necessary to take care of this move.
Change-Id: I28b1acbb5b139614bd4f6a272410a4e4f1f989f7
diff --git a/tempest/api/compute/admin/test_create_server.py b/tempest/api/compute/admin/test_create_server.py
new file mode 100644
index 0000000..3449aba
--- /dev/null
+++ b/tempest/api/compute/admin/test_create_server.py
@@ -0,0 +1,109 @@
+# 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.
+
+import testtools
+
+from tempest.api.compute import base
+from tempest.common.utils.linux import remote_client
+from tempest import config
+from tempest.lib.common.utils import data_utils
+from tempest.lib import decorators
+
+CONF = config.CONF
+
+
+class ServersWithSpecificFlavorTestJSON(base.BaseV2ComputeAdminTest):
+ disk_config = 'AUTO'
+
+ @classmethod
+ def setup_credentials(cls):
+ cls.prepare_instance_network()
+ super(ServersWithSpecificFlavorTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def setup_clients(cls):
+ super(ServersWithSpecificFlavorTestJSON, cls).setup_clients()
+ cls.client = cls.servers_client
+
+ @classmethod
+ def resource_setup(cls):
+ cls.set_validation_resources()
+
+ super(ServersWithSpecificFlavorTestJSON, cls).resource_setup()
+
+ @decorators.idempotent_id('b3c7bcfc-bb5b-4e22-b517-c7f686b802ca')
+ @testtools.skipUnless(CONF.validation.run_validation,
+ 'Instance validation tests are disabled.')
+ def test_verify_created_server_ephemeral_disk(self):
+ # Verify that the ephemeral disk is created when creating server
+ flavor_base = self.flavors_client.show_flavor(
+ self.flavor_ref)['flavor']
+
+ def create_flavor_with_ephemeral(ephem_disk):
+ name = 'flavor_with_ephemeral_%s' % ephem_disk
+ flavor_name = data_utils.rand_name(name)
+
+ ram = flavor_base['ram']
+ vcpus = flavor_base['vcpus']
+ disk = flavor_base['disk']
+
+ # Create a flavor with ephemeral disk
+ flavor = self.create_flavor(name=flavor_name, ram=ram, vcpus=vcpus,
+ disk=disk, ephemeral=ephem_disk)
+ return flavor['id']
+
+ flavor_with_eph_disk_id = create_flavor_with_ephemeral(ephem_disk=1)
+ flavor_no_eph_disk_id = create_flavor_with_ephemeral(ephem_disk=0)
+
+ admin_pass = self.image_ssh_password
+
+ server_no_eph_disk = self.create_test_server(
+ validatable=True,
+ wait_until='ACTIVE',
+ adminPass=admin_pass,
+ flavor=flavor_no_eph_disk_id)
+
+ # Get partition number of server without ephemeral disk.
+ server_no_eph_disk = self.client.show_server(
+ server_no_eph_disk['id'])['server']
+ linux_client = remote_client.RemoteClient(
+ self.get_server_ip(server_no_eph_disk),
+ self.ssh_user,
+ admin_pass,
+ self.validation_resources['keypair']['private_key'],
+ server=server_no_eph_disk,
+ servers_client=self.client)
+ disks_num = len(linux_client.get_disks().split('\n'))
+
+ # Explicit server deletion necessary for Juno compatibility
+ self.client.delete_server(server_no_eph_disk['id'])
+
+ server_with_eph_disk = self.create_test_server(
+ validatable=True,
+ wait_until='ACTIVE',
+ adminPass=admin_pass,
+ flavor=flavor_with_eph_disk_id)
+
+ server_with_eph_disk = self.client.show_server(
+ server_with_eph_disk['id'])['server']
+ linux_client = remote_client.RemoteClient(
+ self.get_server_ip(server_with_eph_disk),
+ self.ssh_user,
+ admin_pass,
+ self.validation_resources['keypair']['private_key'],
+ server=server_with_eph_disk,
+ servers_client=self.client)
+ disks_num_eph = len(linux_client.get_disks().split('\n'))
+ self.assertEqual(disks_num + 1, disks_num_eph)
diff --git a/tempest/api/compute/admin/test_delete_server.py b/tempest/api/compute/admin/test_delete_server.py
new file mode 100644
index 0000000..2569161
--- /dev/null
+++ b/tempest/api/compute/admin/test_delete_server.py
@@ -0,0 +1,52 @@
+# 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.common import waiters
+from tempest import config
+from tempest.lib import decorators
+
+CONF = config.CONF
+
+
+class DeleteServersAdminTestJSON(base.BaseV2ComputeAdminTest):
+ # NOTE: Server creations of each test class should be under 10
+ # for preventing "Quota exceeded for instances".
+
+ @classmethod
+ def setup_clients(cls):
+ super(DeleteServersAdminTestJSON, cls).setup_clients()
+ cls.non_admin_client = cls.servers_client
+ cls.admin_client = cls.os_adm.servers_client
+
+ @decorators.idempotent_id('99774678-e072-49d1-9d2a-49a59bc56063')
+ def test_delete_server_while_in_error_state(self):
+ # Delete a server while it's VM state is error
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.admin_client.reset_state(server['id'], state='error')
+ # Verify server's state
+ server = self.non_admin_client.show_server(server['id'])['server']
+ self.assertEqual(server['status'], 'ERROR')
+ self.non_admin_client.delete_server(server['id'])
+ waiters.wait_for_server_termination(self.servers_client,
+ server['id'],
+ ignore_error=True)
+
+ @decorators.idempotent_id('73177903-6737-4f27-a60c-379e8ae8cf48')
+ def test_admin_delete_servers_of_others(self):
+ # Administrator can delete servers of others
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.admin_client.delete_server(server['id'])
+ waiters.wait_for_server_termination(self.servers_client, server['id'])
diff --git a/tempest/api/compute/test_live_block_migration_negative.py b/tempest/api/compute/admin/test_live_block_migration_negative.py
similarity index 100%
rename from tempest/api/compute/test_live_block_migration_negative.py
rename to tempest/api/compute/admin/test_live_block_migration_negative.py
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index d54c3ec..d44967e 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -226,91 +226,6 @@
self.assertIn(address, network)
-class ServersWithSpecificFlavorTestJSON(base.BaseV2ComputeAdminTest):
- disk_config = 'AUTO'
-
- @classmethod
- def setup_credentials(cls):
- cls.prepare_instance_network()
- super(ServersWithSpecificFlavorTestJSON, cls).setup_credentials()
-
- @classmethod
- def setup_clients(cls):
- super(ServersWithSpecificFlavorTestJSON, cls).setup_clients()
- cls.client = cls.servers_client
-
- @classmethod
- def resource_setup(cls):
- cls.set_validation_resources()
-
- super(ServersWithSpecificFlavorTestJSON, cls).resource_setup()
-
- @decorators.idempotent_id('b3c7bcfc-bb5b-4e22-b517-c7f686b802ca')
- @testtools.skipUnless(CONF.validation.run_validation,
- 'Instance validation tests are disabled.')
- def test_verify_created_server_ephemeral_disk(self):
- # Verify that the ephemeral disk is created when creating server
- flavor_base = self.flavors_client.show_flavor(
- self.flavor_ref)['flavor']
-
- def create_flavor_with_ephemeral(ephem_disk):
- name = 'flavor_with_ephemeral_%s' % ephem_disk
- flavor_name = data_utils.rand_name(name)
-
- ram = flavor_base['ram']
- vcpus = flavor_base['vcpus']
- disk = flavor_base['disk']
-
- # Create a flavor with ephemeral disk
- flavor = self.create_flavor(name=flavor_name, ram=ram, vcpus=vcpus,
- disk=disk, ephemeral=ephem_disk)
- return flavor['id']
-
- flavor_with_eph_disk_id = create_flavor_with_ephemeral(ephem_disk=1)
- flavor_no_eph_disk_id = create_flavor_with_ephemeral(ephem_disk=0)
-
- admin_pass = self.image_ssh_password
-
- server_no_eph_disk = self.create_test_server(
- validatable=True,
- wait_until='ACTIVE',
- adminPass=admin_pass,
- flavor=flavor_no_eph_disk_id)
-
- # Get partition number of server without ephemeral disk.
- server_no_eph_disk = self.client.show_server(
- server_no_eph_disk['id'])['server']
- linux_client = remote_client.RemoteClient(
- self.get_server_ip(server_no_eph_disk),
- self.ssh_user,
- admin_pass,
- self.validation_resources['keypair']['private_key'],
- server=server_no_eph_disk,
- servers_client=self.client)
- disks_num = len(linux_client.get_disks().split('\n'))
-
- # Explicit server deletion necessary for Juno compatibility
- self.client.delete_server(server_no_eph_disk['id'])
-
- server_with_eph_disk = self.create_test_server(
- validatable=True,
- wait_until='ACTIVE',
- adminPass=admin_pass,
- flavor=flavor_with_eph_disk_id)
-
- server_with_eph_disk = self.client.show_server(
- server_with_eph_disk['id'])['server']
- linux_client = remote_client.RemoteClient(
- self.get_server_ip(server_with_eph_disk),
- self.ssh_user,
- admin_pass,
- self.validation_resources['keypair']['private_key'],
- server=server_with_eph_disk,
- servers_client=self.client)
- disks_num_eph = len(linux_client.get_disks().split('\n'))
- self.assertEqual(disks_num + 1, disks_num_eph)
-
-
class ServersTestManualDisk(ServersTestJSON):
disk_config = 'MANUAL'
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index 8ed55e0..2b03b2b 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -117,34 +117,3 @@
waiters.wait_for_server_termination(self.client, server['id'])
waiters.wait_for_volume_resource_status(self.volumes_client,
volume['id'], 'available')
-
-
-class DeleteServersAdminTestJSON(base.BaseV2ComputeAdminTest):
- # NOTE: Server creations of each test class should be under 10
- # for preventing "Quota exceeded for instances".
-
- @classmethod
- def setup_clients(cls):
- super(DeleteServersAdminTestJSON, cls).setup_clients()
- cls.non_admin_client = cls.servers_client
- cls.admin_client = cls.os_adm.servers_client
-
- @decorators.idempotent_id('99774678-e072-49d1-9d2a-49a59bc56063')
- def test_delete_server_while_in_error_state(self):
- # Delete a server while it's VM state is error
- server = self.create_test_server(wait_until='ACTIVE')
- self.admin_client.reset_state(server['id'], state='error')
- # Verify server's state
- server = self.non_admin_client.show_server(server['id'])['server']
- self.assertEqual(server['status'], 'ERROR')
- self.non_admin_client.delete_server(server['id'])
- waiters.wait_for_server_termination(self.servers_client,
- server['id'],
- ignore_error=True)
-
- @decorators.idempotent_id('73177903-6737-4f27-a60c-379e8ae8cf48')
- def test_admin_delete_servers_of_others(self):
- # Administrator can delete servers of others
- server = self.create_test_server(wait_until='ACTIVE')
- self.admin_client.delete_server(server['id'])
- waiters.wait_for_server_termination(self.servers_client, server['id'])