diff options
author | Chris Hoge <chris@openstack.org> | 2016-02-23 16:47:14 -0500 |
---|---|---|
committer | Chris Hoge <chris@openstack.org> | 2016-04-08 10:23:38 -0700 |
commit | 2718b3adce57e5f7f5caf89434ee61aa6b59306e (patch) | |
tree | 0bc6696326d4dbc2b38a79f1a0c252ff3d3d69cb | |
parent | d42f1802d01eec5eea72ca5b1958c3b988b88aa6 (diff) | |
download | tempest-2718b3adce57e5f7f5caf89434ee61aa6b59306e.tar.gz |
Move multi-tenant server negative tests into subclass
Most of the server negative tests only require one tenant/project,
but the base class requires two tenants. This patch creates a
new subclass to isolate the multi-tenant tests, allowing for
fewer resources to be allocated for tests that do not need to
check tenant isolation. This work is in part to support DefCore
efforts [1]
[1] https://review.openstack.org/#/c/253138/
Change-Id: I2319558165a2a098e7af4f6965ed1e00e69c46df
-rw-r--r-- | tempest/api/compute/servers/test_servers_negative.py | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py index 0df6eadb3..8f0e43013 100644 --- a/tempest/api/compute/servers/test_servers_negative.py +++ b/tempest/api/compute/servers/test_servers_negative.py @@ -29,8 +29,6 @@ CONF = config.CONF class ServersNegativeTestJSON(base.BaseV2ComputeTest): - credentials = ['primary', 'alt'] - def setUp(self): super(ServersNegativeTestJSON, self).setUp() try: @@ -47,7 +45,6 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest): def setup_clients(cls): super(ServersNegativeTestJSON, cls).setup_clients() cls.client = cls.servers_client - cls.alt_client = cls.os_alt.servers_client @classmethod def resource_setup(cls): @@ -271,16 +268,6 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest): self.server_id, name=new_name) @test.attr(type=['negative']) - @test.idempotent_id('543d84c1-dd2e-4c6d-8cb2-b9da0efaa384') - def test_update_server_of_another_tenant(self): - # Update name of a server that belongs to another tenant - - new_name = self.server_id + '_new' - self.assertRaises(lib_exc.NotFound, - self.alt_client.update_server, self.server_id, - name=new_name) - - @test.attr(type=['negative']) @test.idempotent_id('5c8e244c-dada-4590-9944-749c455b431f') def test_update_server_name_length_exceeds_256(self): # Update name of server exceed the name length limit @@ -301,14 +288,6 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest): nonexistent_server) @test.attr(type=['negative']) - @test.idempotent_id('5c75009d-3eea-423e-bea3-61b09fd25f9c') - def test_delete_a_server_of_another_tenant(self): - # Delete a server that belongs to another tenant - self.assertRaises(lib_exc.NotFound, - self.alt_client.delete_server, - self.server_id) - - @test.attr(type=['negative']) @test.idempotent_id('75f79124-277c-45e6-a373-a1d6803f4cc4') def test_delete_server_pass_negative_id(self): # Pass an invalid string parameter to delete server @@ -519,3 +498,45 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest): self.assertRaises(lib_exc.Conflict, self.client.unshelve_server, self.server_id) + + +class ServersNegativeTestMultiTenantJSON(base.BaseV2ComputeTest): + + credentials = ['primary', 'alt'] + + def setUp(self): + super(ServersNegativeTestMultiTenantJSON, self).setUp() + try: + waiters.wait_for_server_status(self.client, self.server_id, + 'ACTIVE') + except Exception: + self.__class__.server_id = self.rebuild_server(self.server_id) + + @classmethod + def setup_clients(cls): + super(ServersNegativeTestMultiTenantJSON, cls).setup_clients() + cls.alt_client = cls.os_alt.servers_client + + @classmethod + def resource_setup(cls): + super(ServersNegativeTestMultiTenantJSON, cls).resource_setup() + server = cls.create_test_server(wait_until='ACTIVE') + cls.server_id = server['id'] + + @test.attr(type=['negative']) + @test.idempotent_id('543d84c1-dd2e-4c6d-8cb2-b9da0efaa384') + def test_update_server_of_another_tenant(self): + # Update name of a server that belongs to another tenant + + new_name = self.server_id + '_new' + self.assertRaises(lib_exc.NotFound, + self.alt_client.update_server, self.server_id, + name=new_name) + + @test.attr(type=['negative']) + @test.idempotent_id('5c75009d-3eea-423e-bea3-61b09fd25f9c') + def test_delete_a_server_of_another_tenant(self): + # Delete a server that belongs to another tenant + self.assertRaises(lib_exc.NotFound, + self.alt_client.delete_server, + self.server_id) |