From ab488439da44041f02d76d9ed44dc935c2c60ba4 Mon Sep 17 00:00:00 2001 From: ghanshyam Date: Fri, 27 Jan 2017 05:56:09 +0000 Subject: [PATCH] Switch to decorators.idempotent_id test.idempotent_id is being kept temporary to migrate to new lib interface. Now idempotent_id is available as Tempest stable interface decorators and all plugins tests using the old decorator should be switched to new interface. In future, Once all plugins are switched to new decorator Tempest will remove the test.idempotent_id Change-Id: I249d55fe2ce3f3b51e21ad013f0bfb9c7834da5f Related-Bug: 1616913 --- .../tests/api/admin/test_api_discovery.py | 8 +-- .../tests/api/admin/test_chassis.py | 16 +++--- .../tests/api/admin/test_drivers.py | 6 +-- .../tests/api/admin/test_nodes.py | 36 ++++++------- .../tests/api/admin/test_nodestates.py | 18 +++---- .../tests/api/admin/test_ports.py | 32 ++++++------ .../tests/api/admin/test_ports_negative.py | 51 ++++++++++--------- .../scenario/test_baremetal_basic_ops.py | 3 +- .../scenario/test_baremetal_multitenancy.py | 3 +- 9 files changed, 88 insertions(+), 85 deletions(-) diff --git a/ironic_tempest_plugin/tests/api/admin/test_api_discovery.py b/ironic_tempest_plugin/tests/api/admin/test_api_discovery.py index 2931127a68..de2dada325 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_api_discovery.py +++ b/ironic_tempest_plugin/tests/api/admin/test_api_discovery.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from tempest import test +from tempest.lib import decorators from ironic_tempest_plugin.tests.api.admin import base @@ -18,7 +18,7 @@ from ironic_tempest_plugin.tests.api.admin import base class TestApiDiscovery(base.BaseBaremetalTest): """Tests for API discovery features.""" - @test.idempotent_id('a3c27e94-f56c-42c4-8600-d6790650b9c5') + @decorators.idempotent_id('a3c27e94-f56c-42c4-8600-d6790650b9c5') def test_api_versions(self): _, descr = self.client.get_api_description() expected_versions = ('v1',) @@ -27,13 +27,13 @@ class TestApiDiscovery(base.BaseBaremetalTest): for v in expected_versions: self.assertIn(v, versions) - @test.idempotent_id('896283a6-488e-4f31-af78-6614286cbe0d') + @decorators.idempotent_id('896283a6-488e-4f31-af78-6614286cbe0d') def test_default_version(self): _, descr = self.client.get_api_description() default_version = descr['default_version'] self.assertEqual('v1', default_version['id']) - @test.idempotent_id('abc0b34d-e684-4546-9728-ab7a9ad9f174') + @decorators.idempotent_id('abc0b34d-e684-4546-9728-ab7a9ad9f174') def test_version_1_resources(self): _, descr = self.client.get_version_description(version='v1') expected_resources = ('nodes', 'chassis', diff --git a/ironic_tempest_plugin/tests/api/admin/test_chassis.py b/ironic_tempest_plugin/tests/api/admin/test_chassis.py index fc313fcbdb..52109e0ff7 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_chassis.py +++ b/ironic_tempest_plugin/tests/api/admin/test_chassis.py @@ -12,8 +12,8 @@ # under the License. from tempest.lib.common.utils import data_utils +from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test from ironic_tempest_plugin.tests.api.admin import base @@ -33,13 +33,13 @@ class TestChassis(base.BaseBaremetalTest): self.assertIn(key, actual) self.assertEqual(value, actual[key]) - @test.idempotent_id('7c5a2e09-699c-44be-89ed-2bc189992d42') + @decorators.idempotent_id('7c5a2e09-699c-44be-89ed-2bc189992d42') def test_create_chassis(self): descr = data_utils.rand_name('test-chassis') _, chassis = self.create_chassis(description=descr) self.assertEqual(descr, chassis['description']) - @test.idempotent_id('cabe9c6f-dc16-41a7-b6b9-0a90c212edd5') + @decorators.idempotent_id('cabe9c6f-dc16-41a7-b6b9-0a90c212edd5') def test_create_chassis_unicode_description(self): # Use a unicode string for testing: # 'We ♡ OpenStack in Ukraine' @@ -47,18 +47,18 @@ class TestChassis(base.BaseBaremetalTest): _, chassis = self.create_chassis(description=descr) self.assertEqual(descr, chassis['description']) - @test.idempotent_id('c84644df-31c4-49db-a307-8942881f41c0') + @decorators.idempotent_id('c84644df-31c4-49db-a307-8942881f41c0') def test_show_chassis(self): _, chassis = self.client.show_chassis(self.chassis['uuid']) self._assertExpected(self.chassis, chassis) - @test.idempotent_id('29c9cd3f-19b5-417b-9864-99512c3b33b3') + @decorators.idempotent_id('29c9cd3f-19b5-417b-9864-99512c3b33b3') def test_list_chassis(self): _, body = self.client.list_chassis() self.assertIn(self.chassis['uuid'], [i['uuid'] for i in body['chassis']]) - @test.idempotent_id('5ae649ad-22d1-4fe1-bbc6-97227d199fb3') + @decorators.idempotent_id('5ae649ad-22d1-4fe1-bbc6-97227d199fb3') def test_delete_chassis(self): _, body = self.create_chassis() uuid = body['uuid'] @@ -66,7 +66,7 @@ class TestChassis(base.BaseBaremetalTest): self.delete_chassis(uuid) self.assertRaises(lib_exc.NotFound, self.client.show_chassis, uuid) - @test.idempotent_id('cda8a41f-6be2-4cbf-840c-994b00a89b44') + @decorators.idempotent_id('cda8a41f-6be2-4cbf-840c-994b00a89b44') def test_update_chassis(self): _, body = self.create_chassis() uuid = body['uuid'] @@ -77,7 +77,7 @@ class TestChassis(base.BaseBaremetalTest): _, chassis = self.client.show_chassis(uuid) self.assertEqual(new_description, chassis['description']) - @test.idempotent_id('76305e22-a4e2-4ab3-855c-f4e2368b9335') + @decorators.idempotent_id('76305e22-a4e2-4ab3-855c-f4e2368b9335') def test_chassis_node_list(self): _, node = self.create_node(self.chassis['uuid']) _, body = self.client.list_chassis_nodes(self.chassis['uuid']) diff --git a/ironic_tempest_plugin/tests/api/admin/test_drivers.py b/ironic_tempest_plugin/tests/api/admin/test_drivers.py index c9319b6691..c3d1973a02 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_drivers.py +++ b/ironic_tempest_plugin/tests/api/admin/test_drivers.py @@ -13,7 +13,7 @@ # under the License. from tempest import config -from tempest import test +from tempest.lib import decorators from ironic_tempest_plugin.tests.api.admin import base @@ -27,13 +27,13 @@ class TestDrivers(base.BaseBaremetalTest): super(TestDrivers, cls).resource_setup() cls.driver_name = CONF.baremetal.driver - @test.idempotent_id('5aed2790-7592-4655-9b16-99abcc2e6ec5') + @decorators.idempotent_id('5aed2790-7592-4655-9b16-99abcc2e6ec5') def test_list_drivers(self): _, drivers = self.client.list_drivers() self.assertIn(self.driver_name, [d['name'] for d in drivers['drivers']]) - @test.idempotent_id('fb3287a3-c4d7-44bf-ae9d-1eef906d78ce') + @decorators.idempotent_id('fb3287a3-c4d7-44bf-ae9d-1eef906d78ce') def test_show_driver(self): _, driver = self.client.show_driver(self.driver_name) self.assertEqual(self.driver_name, driver['name']) diff --git a/ironic_tempest_plugin/tests/api/admin/test_nodes.py b/ironic_tempest_plugin/tests/api/admin/test_nodes.py index bf37ca8011..8f1b0da0a5 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_nodes.py +++ b/ironic_tempest_plugin/tests/api/admin/test_nodes.py @@ -12,8 +12,8 @@ import six from tempest.lib.common.utils import data_utils +from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test from ironic_tempest_plugin.common import waiters from ironic_tempest_plugin.tests.api.admin import api_microversion_fixture @@ -47,7 +47,7 @@ class TestNodes(base.BaseBaremetalTest): uuid=self.node['uuid'], instance_uuid=None) return instance_uuid - @test.idempotent_id('4e939eb2-8a69-4e84-8652-6fffcbc9db8f') + @decorators.idempotent_id('4e939eb2-8a69-4e84-8652-6fffcbc9db8f') def test_create_node(self): params = {'cpu_arch': 'x86_64', 'cpus': '12', @@ -57,7 +57,7 @@ class TestNodes(base.BaseBaremetalTest): _, body = self.create_node(self.chassis['uuid'], **params) self._assertExpected(params, body['properties']) - @test.idempotent_id('9ade60a4-505e-4259-9ec4-71352cbbaf47') + @decorators.idempotent_id('9ade60a4-505e-4259-9ec4-71352cbbaf47') def test_delete_node(self): _, node = self.create_node(self.chassis['uuid']) @@ -66,18 +66,18 @@ class TestNodes(base.BaseBaremetalTest): self.assertRaises(lib_exc.NotFound, self.client.show_node, node['uuid']) - @test.idempotent_id('55451300-057c-4ecf-8255-ba42a83d3a03') + @decorators.idempotent_id('55451300-057c-4ecf-8255-ba42a83d3a03') def test_show_node(self): _, loaded_node = self.client.show_node(self.node['uuid']) self._assertExpected(self.node, loaded_node) - @test.idempotent_id('4ca123c4-160d-4d8d-a3f7-15feda812263') + @decorators.idempotent_id('4ca123c4-160d-4d8d-a3f7-15feda812263') def test_list_nodes(self): _, body = self.client.list_nodes() self.assertIn(self.node['uuid'], [i['uuid'] for i in body['nodes']]) - @test.idempotent_id('85b1f6e0-57fd-424c-aeff-c3422920556f') + @decorators.idempotent_id('85b1f6e0-57fd-424c-aeff-c3422920556f') def test_list_nodes_association(self): _, body = self.client.list_nodes(associated=True) self.assertNotIn(self.node['uuid'], @@ -91,7 +91,7 @@ class TestNodes(base.BaseBaremetalTest): _, body = self.client.list_nodes(associated=False) self.assertNotIn(self.node['uuid'], [n['uuid'] for n in body['nodes']]) - @test.idempotent_id('18c4ebd8-f83a-4df7-9653-9fb33a329730') + @decorators.idempotent_id('18c4ebd8-f83a-4df7-9653-9fb33a329730') def test_node_port_list(self): _, port = self.create_port(self.node['uuid'], data_utils.rand_mac_address()) @@ -99,13 +99,13 @@ class TestNodes(base.BaseBaremetalTest): self.assertIn(port['uuid'], [p['uuid'] for p in body['ports']]) - @test.idempotent_id('72591acb-f215-49db-8395-710d14eb86ab') + @decorators.idempotent_id('72591acb-f215-49db-8395-710d14eb86ab') def test_node_port_list_no_ports(self): _, node = self.create_node(self.chassis['uuid']) _, body = self.client.list_node_ports(node['uuid']) self.assertEmpty(body['ports']) - @test.idempotent_id('4fed270a-677a-4d19-be87-fd38ae490320') + @decorators.idempotent_id('4fed270a-677a-4d19-be87-fd38ae490320') def test_update_node(self): props = {'cpu_arch': 'x86_64', 'cpus': '12', @@ -123,18 +123,18 @@ class TestNodes(base.BaseBaremetalTest): _, node = self.client.show_node(node['uuid']) self._assertExpected(new_p, node['properties']) - @test.idempotent_id('cbf1f515-5f4b-4e49-945c-86bcaccfeb1d') + @decorators.idempotent_id('cbf1f515-5f4b-4e49-945c-86bcaccfeb1d') def test_validate_driver_interface(self): _, body = self.client.validate_driver_interface(self.node['uuid']) core_interfaces = ['power', 'deploy'] for interface in core_interfaces: self.assertIn(interface, body) - @test.idempotent_id('5519371c-26a2-46e9-aa1a-f74226e9d71f') + @decorators.idempotent_id('5519371c-26a2-46e9-aa1a-f74226e9d71f') def test_set_node_boot_device(self): self.client.set_node_boot_device(self.node['uuid'], 'pxe') - @test.idempotent_id('9ea73775-f578-40b9-bc34-efc639c4f21f') + @decorators.idempotent_id('9ea73775-f578-40b9-bc34-efc639c4f21f') def test_get_node_boot_device(self): body = self.client.get_node_boot_device(self.node['uuid']) self.assertIn('boot_device', body) @@ -142,26 +142,26 @@ class TestNodes(base.BaseBaremetalTest): self.assertIsInstance(body['boot_device'], six.string_types) self.assertIsInstance(body['persistent'], bool) - @test.idempotent_id('3622bc6f-3589-4bc2-89f3-50419c66b133') + @decorators.idempotent_id('3622bc6f-3589-4bc2-89f3-50419c66b133') def test_get_node_supported_boot_devices(self): body = self.client.get_node_supported_boot_devices(self.node['uuid']) self.assertIn('supported_boot_devices', body) self.assertIsInstance(body['supported_boot_devices'], list) - @test.idempotent_id('f63b6288-1137-4426-8cfe-0d5b7eb87c06') + @decorators.idempotent_id('f63b6288-1137-4426-8cfe-0d5b7eb87c06') def test_get_console(self): _, body = self.client.get_console(self.node['uuid']) con_info = ['console_enabled', 'console_info'] for key in con_info: self.assertIn(key, body) - @test.idempotent_id('80504575-9b21-4670-92d1-143b948f9437') + @decorators.idempotent_id('80504575-9b21-4670-92d1-143b948f9437') def test_set_console_mode(self): self.client.set_console_mode(self.node['uuid'], True) waiters.wait_for_bm_node_status(self.client, self.node['uuid'], 'console_enabled', True) - @test.idempotent_id('b02a4f38-5e8b-44b2-aed2-a69a36ecfd69') + @decorators.idempotent_id('b02a4f38-5e8b-44b2-aed2-a69a36ecfd69') def test_get_node_by_instance_uuid(self): instance_uuid = self._associate_node_with_instance() _, body = self.client.show_node_by_instance_uuid(instance_uuid) @@ -179,7 +179,7 @@ class TestNodesVif(base.BaseBaremetalTest): _, self.chassis = self.create_chassis() _, self.node = self.create_node(self.chassis['uuid']) - @test.idempotent_id('a3d319d0-cacb-4e55-a3dc-3fa8b74880f1') + @decorators.idempotent_id('a3d319d0-cacb-4e55-a3dc-3fa8b74880f1') def test_vifs(self): self.useFixture( api_microversion_fixture.APIMicroversionFixture('1.28')) @@ -190,7 +190,7 @@ class TestNodesVif(base.BaseBaremetalTest): self.assertEqual(body, {'vifs': [{'id': 'test-vif'}]}) self.client.vif_detach(self.node['uuid'], 'test-vif') - @test.idempotent_id('a3d319d0-cacb-4e55-a3dc-3fa8b74880f2') + @decorators.idempotent_id('a3d319d0-cacb-4e55-a3dc-3fa8b74880f2') def test_vif_already_set_on_extra(self): self.useFixture( api_microversion_fixture.APIMicroversionFixture('1.28')) diff --git a/ironic_tempest_plugin/tests/api/admin/test_nodestates.py b/ironic_tempest_plugin/tests/api/admin/test_nodestates.py index a491f6ff98..f2a33eb32b 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_nodestates.py +++ b/ironic_tempest_plugin/tests/api/admin/test_nodestates.py @@ -13,8 +13,8 @@ # under the License. from oslo_utils import timeutils +from tempest.lib import decorators from tempest.lib import exceptions -from tempest import test from ironic_tempest_plugin.tests.api.admin import api_microversion_fixture from ironic_tempest_plugin.tests.api.admin import base @@ -56,14 +56,14 @@ class TestNodeStatesMixin(object): 'timeout': self.unprovision_timeout}) raise exceptions.TimeoutException(message) - @test.idempotent_id('cd8afa5e-3f57-4e43-8185-beb83d3c9015') + @decorators.idempotent_id('cd8afa5e-3f57-4e43-8185-beb83d3c9015') def test_list_nodestates(self): _, node = self.create_node(self.chassis['uuid']) _, nodestates = self.client.list_nodestates(node['uuid']) for key in nodestates: self.assertEqual(nodestates[key], node[key]) - @test.idempotent_id('fc5b9320-0c98-4e5a-8848-877fe5a0322c') + @decorators.idempotent_id('fc5b9320-0c98-4e5a-8848-877fe5a0322c') def test_set_node_power_state(self): _, node = self.create_node(self.chassis['uuid']) states = ["power on", "rebooting", "power off"] @@ -76,7 +76,7 @@ class TestNodeStatesMixin(object): class TestNodeStatesV1_1(TestNodeStatesMixin, base.BaseBaremetalTest): - @test.idempotent_id('ccb8fca9-2ba0-480c-a037-34c3bd09dc74') + @decorators.idempotent_id('ccb8fca9-2ba0-480c-a037-34c3bd09dc74') def test_set_node_provision_state(self): _, node = self.create_node(self.chassis['uuid']) # Nodes appear in NONE state by default until v1.1 @@ -95,7 +95,7 @@ class TestNodeStatesV1_2(TestNodeStatesMixin, base.BaseBaremetalTest): super(TestNodeStatesV1_2, self).setUp() self.useFixture(api_microversion_fixture.APIMicroversionFixture('1.2')) - @test.idempotent_id('9c414984-f3b6-4b3d-81da-93b60d4662fb') + @decorators.idempotent_id('9c414984-f3b6-4b3d-81da-93b60d4662fb') def test_set_node_provision_state(self): _, node = self.create_node(self.chassis['uuid']) # Nodes appear in AVAILABLE state by default from v1.2 to v1.10 @@ -114,7 +114,7 @@ class TestNodeStatesV1_4(TestNodeStatesMixin, base.BaseBaremetalTest): super(TestNodeStatesV1_4, self).setUp() self.useFixture(api_microversion_fixture.APIMicroversionFixture('1.4')) - @test.idempotent_id('3d606003-05ce-4b5a-964d-bdee382fafe9') + @decorators.idempotent_id('3d606003-05ce-4b5a-964d-bdee382fafe9') def test_set_node_provision_state(self): _, node = self.create_node(self.chassis['uuid']) # Nodes appear in AVAILABLE state by default from v1.2 to v1.10 @@ -136,7 +136,7 @@ class TestNodeStatesV1_6(TestNodeStatesMixin, base.BaseBaremetalTest): super(TestNodeStatesV1_6, self).setUp() self.useFixture(api_microversion_fixture.APIMicroversionFixture('1.6')) - @test.idempotent_id('6c9ce4a3-713b-4c76-91af-18c48d01f1bb') + @decorators.idempotent_id('6c9ce4a3-713b-4c76-91af-18c48d01f1bb') def test_set_node_provision_state(self): _, node = self.create_node(self.chassis['uuid']) # Nodes appear in AVAILABLE state by default from v1.2 to v1.10 @@ -160,7 +160,7 @@ class TestNodeStatesV1_11(TestNodeStatesMixin, base.BaseBaremetalTest): api_microversion_fixture.APIMicroversionFixture('1.11') ) - @test.idempotent_id('31f53828-b83d-40c7-98e5-843e28a1b6b9') + @decorators.idempotent_id('31f53828-b83d-40c7-98e5-843e28a1b6b9') def test_set_node_provision_state(self): _, node = self.create_node(self.chassis['uuid']) # Nodes appear in ENROLL state by default from v1.11 @@ -183,7 +183,7 @@ class TestNodeStatesV1_12(TestNodeStatesMixin, base.BaseBaremetalTest): api_microversion_fixture.APIMicroversionFixture('1.12') ) - @test.idempotent_id('4427b1ca-8e79-4139-83d6-77dfac03e61e') + @decorators.idempotent_id('4427b1ca-8e79-4139-83d6-77dfac03e61e') def test_set_node_raid_config(self): _, node = self.create_node(self.chassis['uuid']) target_raid_config = {'logical_disks': [{'size_gb': 100, diff --git a/ironic_tempest_plugin/tests/api/admin/test_ports.py b/ironic_tempest_plugin/tests/api/admin/test_ports.py index 599e41bd24..ed2e911452 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_ports.py +++ b/ironic_tempest_plugin/tests/api/admin/test_ports.py @@ -11,8 +11,8 @@ # under the License. from tempest.lib.common.utils import data_utils +from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test from ironic_tempest_plugin.tests.api.admin import base @@ -35,7 +35,7 @@ class TestPorts(base.BaseBaremetalTest): self.assertIn(key, actual) self.assertEqual(value, actual[key]) - @test.idempotent_id('83975898-2e50-42ed-b5f0-e510e36a0b56') + @decorators.idempotent_id('83975898-2e50-42ed-b5f0-e510e36a0b56') def test_create_port(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -46,7 +46,7 @@ class TestPorts(base.BaseBaremetalTest): self._assertExpected(port, body) - @test.idempotent_id('d1f6b249-4cf6-4fe6-9ed6-a6e84b1bf67b') + @decorators.idempotent_id('d1f6b249-4cf6-4fe6-9ed6-a6e84b1bf67b') def test_create_port_specifying_uuid(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -58,7 +58,7 @@ class TestPorts(base.BaseBaremetalTest): _, body = self.client.show_port(uuid) self._assertExpected(port, body) - @test.idempotent_id('4a02c4b0-6573-42a4-a513-2e36ad485b62') + @decorators.idempotent_id('4a02c4b0-6573-42a4-a513-2e36ad485b62') def test_create_port_with_extra(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -71,7 +71,7 @@ class TestPorts(base.BaseBaremetalTest): _, body = self.client.show_port(port['uuid']) self._assertExpected(port, body) - @test.idempotent_id('1bf257a9-aea3-494e-89c0-63f657ab4fdd') + @decorators.idempotent_id('1bf257a9-aea3-494e-89c0-63f657ab4fdd') def test_delete_port(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -82,24 +82,24 @@ class TestPorts(base.BaseBaremetalTest): self.assertRaises(lib_exc.NotFound, self.client.show_port, port['uuid']) - @test.idempotent_id('9fa77ab5-ce59-4f05-baac-148904ba1597') + @decorators.idempotent_id('9fa77ab5-ce59-4f05-baac-148904ba1597') def test_show_port(self): _, port = self.client.show_port(self.port['uuid']) self._assertExpected(self.port, port) - @test.idempotent_id('7c1114ff-fc3f-47bb-bc2f-68f61620ba8b') + @decorators.idempotent_id('7c1114ff-fc3f-47bb-bc2f-68f61620ba8b') def test_show_port_by_address(self): _, port = self.client.show_port_by_address(self.port['address']) self._assertExpected(self.port, port['ports'][0]) - @test.idempotent_id('bd773405-aea5-465d-b576-0ab1780069e5') + @decorators.idempotent_id('bd773405-aea5-465d-b576-0ab1780069e5') def test_show_port_with_links(self): _, port = self.client.show_port(self.port['uuid']) self.assertIn('links', port.keys()) self.assertEqual(2, len(port['links'])) self.assertIn(port['uuid'], port['links'][0]['href']) - @test.idempotent_id('b5e91854-5cd7-4a8e-bb35-3e0a1314606d') + @decorators.idempotent_id('b5e91854-5cd7-4a8e-bb35-3e0a1314606d') def test_list_ports(self): _, body = self.client.list_ports() self.assertIn(self.port['uuid'], @@ -109,14 +109,14 @@ class TestPorts(base.BaseBaremetalTest): self.validate_self_link('ports', port['uuid'], port['links'][0]['href']) - @test.idempotent_id('324a910e-2f80-4258-9087-062b5ae06240') + @decorators.idempotent_id('324a910e-2f80-4258-9087-062b5ae06240') def test_list_with_limit(self): _, body = self.client.list_ports(limit=3) next_marker = body['ports'][-1]['uuid'] self.assertIn(next_marker, body['next']) - @test.idempotent_id('8a94b50f-9895-4a63-a574-7ecff86e5875') + @decorators.idempotent_id('8a94b50f-9895-4a63-a574-7ecff86e5875') def test_list_ports_details(self): node_id = self.node['uuid'] @@ -141,7 +141,7 @@ class TestPorts(base.BaseBaremetalTest): self.validate_self_link('ports', port['uuid'], port['links'][0]['href']) - @test.idempotent_id('8a03f688-7d75-4ecd-8cbc-e06b8f346738') + @decorators.idempotent_id('8a03f688-7d75-4ecd-8cbc-e06b8f346738') def test_list_ports_details_with_address(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -154,7 +154,7 @@ class TestPorts(base.BaseBaremetalTest): self.assertEqual(1, len(body['ports'])) self.assertEqual(address, body['ports'][0]['address']) - @test.idempotent_id('9c26298b-1bcb-47b7-9b9e-8bdd6e3c4aba') + @decorators.idempotent_id('9c26298b-1bcb-47b7-9b9e-8bdd6e3c4aba') def test_update_port_replace(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -186,7 +186,7 @@ class TestPorts(base.BaseBaremetalTest): self.assertEqual(new_address, body['address']) self.assertEqual(new_extra, body['extra']) - @test.idempotent_id('d7e7fece-6ed9-460a-9ebe-9267217e8580') + @decorators.idempotent_id('d7e7fece-6ed9-460a-9ebe-9267217e8580') def test_update_port_remove(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -213,7 +213,7 @@ class TestPorts(base.BaseBaremetalTest): self.assertEqual(node_id, body['node_uuid']) self.assertEqual(address, body['address']) - @test.idempotent_id('241288b3-e98a-400f-a4d7-d1f716146361') + @decorators.idempotent_id('241288b3-e98a-400f-a4d7-d1f716146361') def test_update_port_add(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -234,7 +234,7 @@ class TestPorts(base.BaseBaremetalTest): _, body = self.client.show_port(port['uuid']) self.assertEqual(extra, body['extra']) - @test.idempotent_id('5309e897-0799-4649-a982-0179b04c3876') + @decorators.idempotent_id('5309e897-0799-4649-a982-0179b04c3876') def test_update_port_mixed_ops(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() diff --git a/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py b/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py index ffac7d3a0f..f9fa74684c 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py +++ b/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py @@ -11,6 +11,7 @@ # under the License. from tempest.lib.common.utils import data_utils +from tempest.lib import decorators from tempest.lib import exceptions as lib_exc from tempest import test @@ -27,7 +28,7 @@ class TestPortsNegative(base.BaseBaremetalTest): _, self.node = self.create_node(self.chassis['uuid']) @test.attr(type=['negative']) - @test.idempotent_id('0a6ee1f7-d0d9-4069-8778-37f3aa07303a') + @decorators.idempotent_id('0a6ee1f7-d0d9-4069-8778-37f3aa07303a') def test_create_port_malformed_mac(self): node_id = self.node['uuid'] address = 'malformed:mac' @@ -36,7 +37,7 @@ class TestPortsNegative(base.BaseBaremetalTest): self.create_port, node_id=node_id, address=address) @test.attr(type=['negative']) - @test.idempotent_id('30277ee8-0c60-4f1d-b125-0e51c2f43369') + @decorators.idempotent_id('30277ee8-0c60-4f1d-b125-0e51c2f43369') def test_create_port_nonexsistent_node_id(self): node_id = str(data_utils.rand_uuid()) address = data_utils.rand_mac_address() @@ -44,25 +45,25 @@ class TestPortsNegative(base.BaseBaremetalTest): node_id=node_id, address=address) @test.attr(type=['negative']) - @test.idempotent_id('029190f6-43e1-40a3-b64a-65173ba653a3') + @decorators.idempotent_id('029190f6-43e1-40a3-b64a-65173ba653a3') def test_show_port_malformed_uuid(self): self.assertRaises(lib_exc.BadRequest, self.client.show_port, 'malformed:uuid') @test.attr(type=['negative']) - @test.idempotent_id('0d00e13d-e2e0-45b1-bcbc-55a6d90ca793') + @decorators.idempotent_id('0d00e13d-e2e0-45b1-bcbc-55a6d90ca793') def test_show_port_nonexistent_uuid(self): self.assertRaises(lib_exc.NotFound, self.client.show_port, data_utils.rand_uuid()) @test.attr(type=['negative']) - @test.idempotent_id('4ad85266-31e9-4942-99ac-751897dc9e23') + @decorators.idempotent_id('4ad85266-31e9-4942-99ac-751897dc9e23') def test_show_port_by_mac_not_allowed(self): self.assertRaises(lib_exc.BadRequest, self.client.show_port, data_utils.rand_mac_address()) @test.attr(type=['negative']) - @test.idempotent_id('89a34380-3c61-4c32-955c-2cd9ce94da21') + @decorators.idempotent_id('89a34380-3c61-4c32-955c-2cd9ce94da21') def test_create_port_duplicated_port_uuid(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -73,7 +74,7 @@ class TestPortsNegative(base.BaseBaremetalTest): address=address, uuid=uuid) @test.attr(type=['negative']) - @test.idempotent_id('65e84917-733c-40ae-ae4b-96a4adff931c') + @decorators.idempotent_id('65e84917-733c-40ae-ae4b-96a4adff931c') def test_create_port_no_mandatory_field_node_id(self): address = data_utils.rand_mac_address() @@ -81,7 +82,7 @@ class TestPortsNegative(base.BaseBaremetalTest): address=address) @test.attr(type=['negative']) - @test.idempotent_id('bcea3476-7033-4183-acfe-e56a30809b46') + @decorators.idempotent_id('bcea3476-7033-4183-acfe-e56a30809b46') def test_create_port_no_mandatory_field_mac(self): node_id = self.node['uuid'] @@ -89,7 +90,7 @@ class TestPortsNegative(base.BaseBaremetalTest): node_id=node_id, address=None) @test.attr(type=['negative']) - @test.idempotent_id('2b51cd18-fb95-458b-9780-e6257787b649') + @decorators.idempotent_id('2b51cd18-fb95-458b-9780-e6257787b649') def test_create_port_malformed_port_uuid(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -99,14 +100,14 @@ class TestPortsNegative(base.BaseBaremetalTest): node_id=node_id, address=address, uuid=uuid) @test.attr(type=['negative']) - @test.idempotent_id('583a6856-6a30-4ac4-889f-14e2adff8105') + @decorators.idempotent_id('583a6856-6a30-4ac4-889f-14e2adff8105') def test_create_port_malformed_node_id(self): address = data_utils.rand_mac_address() self.assertRaises(lib_exc.BadRequest, self.create_port, node_id='malformed:nodeid', address=address) @test.attr(type=['negative']) - @test.idempotent_id('e27f8b2e-42c6-4a43-a3cd-accff716bc5c') + @decorators.idempotent_id('e27f8b2e-42c6-4a43-a3cd-accff716bc5c') def test_create_port_duplicated_mac(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -116,7 +117,7 @@ class TestPortsNegative(base.BaseBaremetalTest): address=address) @test.attr(type=['negative']) - @test.idempotent_id('8907082d-ac5e-4be3-b05f-d072ede82020') + @decorators.idempotent_id('8907082d-ac5e-4be3-b05f-d072ede82020') def test_update_port_by_mac_not_allowed(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -133,7 +134,7 @@ class TestPortsNegative(base.BaseBaremetalTest): patch) @test.attr(type=['negative']) - @test.idempotent_id('df1ac70c-db9f-41d9-90f1-78cd6b905718') + @decorators.idempotent_id('df1ac70c-db9f-41d9-90f1-78cd6b905718') def test_update_port_nonexistent(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -152,7 +153,7 @@ class TestPortsNegative(base.BaseBaremetalTest): self.client.update_port, port_id, patch) @test.attr(type=['negative']) - @test.idempotent_id('c701e315-aa52-41ea-817c-65c5ca8ca2a8') + @decorators.idempotent_id('c701e315-aa52-41ea-817c-65c5ca8ca2a8') def test_update_port_malformed_port_uuid(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -166,7 +167,7 @@ class TestPortsNegative(base.BaseBaremetalTest): 'value': new_address}]) @test.attr(type=['negative']) - @test.idempotent_id('f8f15803-34d6-45dc-b06f-e5e04bf1b38b') + @decorators.idempotent_id('f8f15803-34d6-45dc-b06f-e5e04bf1b38b') def test_update_port_add_nonexistent_property(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -179,7 +180,7 @@ class TestPortsNegative(base.BaseBaremetalTest): 'value': 'value'}]) @test.attr(type=['negative']) - @test.idempotent_id('898ec904-38b1-4fcb-9584-1187d4263a2a') + @decorators.idempotent_id('898ec904-38b1-4fcb-9584-1187d4263a2a') def test_update_port_replace_node_id_with_malformed(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -194,7 +195,7 @@ class TestPortsNegative(base.BaseBaremetalTest): self.client.update_port, port_id, patch) @test.attr(type=['negative']) - @test.idempotent_id('2949f30f-5f59-43fa-a6d9-4eac578afab4') + @decorators.idempotent_id('2949f30f-5f59-43fa-a6d9-4eac578afab4') def test_update_port_replace_mac_with_duplicated(self): node_id = self.node['uuid'] address1 = data_utils.rand_mac_address() @@ -212,7 +213,7 @@ class TestPortsNegative(base.BaseBaremetalTest): self.client.update_port, port_id, patch) @test.attr(type=['negative']) - @test.idempotent_id('97f6e048-6e4f-4eba-a09d-fbbc78b77a77') + @decorators.idempotent_id('97f6e048-6e4f-4eba-a09d-fbbc78b77a77') def test_update_port_replace_node_id_with_nonexistent(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -227,7 +228,7 @@ class TestPortsNegative(base.BaseBaremetalTest): self.client.update_port, port_id, patch) @test.attr(type=['negative']) - @test.idempotent_id('375022c5-9e9e-4b11-9ca4-656729c0c9b2') + @decorators.idempotent_id('375022c5-9e9e-4b11-9ca4-656729c0c9b2') def test_update_port_replace_mac_with_malformed(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -243,7 +244,7 @@ class TestPortsNegative(base.BaseBaremetalTest): self.client.update_port, port_id, patch) @test.attr(type=['negative']) - @test.idempotent_id('5722b853-03fc-4854-8308-2036a1b67d85') + @decorators.idempotent_id('5722b853-03fc-4854-8308-2036a1b67d85') def test_update_port_replace_nonexistent_property(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -257,7 +258,7 @@ class TestPortsNegative(base.BaseBaremetalTest): self.client.update_port, port_id, patch) @test.attr(type=['negative']) - @test.idempotent_id('ae2696ca-930a-4a7f-918f-30ae97c60f56') + @decorators.idempotent_id('ae2696ca-930a-4a7f-918f-30ae97c60f56') def test_update_port_remove_mandatory_field_mac(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -269,7 +270,7 @@ class TestPortsNegative(base.BaseBaremetalTest): [{'path': '/address', 'op': 'remove'}]) @test.attr(type=['negative']) - @test.idempotent_id('5392c1f0-2071-4697-9064-ec2d63019018') + @decorators.idempotent_id('5392c1f0-2071-4697-9064-ec2d63019018') def test_update_port_remove_mandatory_field_port_uuid(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -281,7 +282,7 @@ class TestPortsNegative(base.BaseBaremetalTest): [{'path': '/uuid', 'op': 'remove'}]) @test.attr(type=['negative']) - @test.idempotent_id('06b50d82-802a-47ef-b079-0a3311cf85a2') + @decorators.idempotent_id('06b50d82-802a-47ef-b079-0a3311cf85a2') def test_update_port_remove_nonexistent_property(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -293,7 +294,7 @@ class TestPortsNegative(base.BaseBaremetalTest): [{'path': '/nonexistent', 'op': 'remove'}]) @test.attr(type=['negative']) - @test.idempotent_id('03d42391-2145-4a6c-95bf-63fe55eb64fd') + @decorators.idempotent_id('03d42391-2145-4a6c-95bf-63fe55eb64fd') def test_delete_port_by_mac_not_allowed(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() @@ -302,7 +303,7 @@ class TestPortsNegative(base.BaseBaremetalTest): self.assertRaises(lib_exc.BadRequest, self.client.delete_port, address) @test.attr(type=['negative']) - @test.idempotent_id('0629e002-818e-4763-b25b-ae5e07b1cb23') + @decorators.idempotent_id('0629e002-818e-4763-b25b-ae5e07b1cb23') def test_update_port_mixed_ops_integrity(self): node_id = self.node['uuid'] address = data_utils.rand_mac_address() diff --git a/ironic_tempest_plugin/tests/scenario/test_baremetal_basic_ops.py b/ironic_tempest_plugin/tests/scenario/test_baremetal_basic_ops.py index a17efc6cc9..63108c756a 100644 --- a/ironic_tempest_plugin/tests/scenario/test_baremetal_basic_ops.py +++ b/ironic_tempest_plugin/tests/scenario/test_baremetal_basic_ops.py @@ -17,6 +17,7 @@ from oslo_log import log as logging from tempest.common import waiters from tempest import config from tempest.lib.common import api_version_request +from tempest.lib import decorators from tempest import test from ironic_tempest_plugin.tests.scenario import baremetal_manager @@ -123,7 +124,7 @@ class BaremetalBasicOps(baremetal_manager.BaremetalScenarioTest): self.assertEqual(n_port['device_id'], self.instance['id']) self.assertIn(n_port['mac_address'], ir_ports_addresses) - @test.idempotent_id('549173a5-38ec-42bb-b0e2-c8b9f4a08943') + @decorators.idempotent_id('549173a5-38ec-42bb-b0e2-c8b9f4a08943') @test.services('compute', 'image', 'network') def test_baremetal_server_ops(self): self.add_keypair() diff --git a/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py b/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py index 45ad79f3e0..497e809f90 100644 --- a/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py +++ b/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py @@ -16,6 +16,7 @@ from ironic_tempest_plugin.tests.scenario import baremetal_manager from tempest import config from tempest.lib.common.utils import data_utils +from tempest.lib import decorators from tempest.scenario import manager from tempest import test @@ -79,7 +80,7 @@ class BaremetalMultitenancy(baremetal_manager.BaremetalScenarioTest, else: self.assertNotIn(success_substring, output) - @test.idempotent_id('26e2f145-2a8e-4dc7-8457-7f2eb2c6749d') + @decorators.idempotent_id('26e2f145-2a8e-4dc7-8457-7f2eb2c6749d') @test.services('compute', 'image', 'network') def test_baremetal_multitenancy(self):