From 353095f14df7bdd19ba850568de12f950c4a955b Mon Sep 17 00:00:00 2001 From: ghanshyam Date: Fri, 27 Jan 2017 06:09:44 +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: Idede7bdae690e293ca204c5e3788f7e5144e7680 Related-Bug: 1616913 --- .../api/test_bgp_speaker_extensions.py | 19 ++++++++++--------- .../test_bgp_speaker_extensions_negative.py | 11 ++++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/neutron_dynamic_routing/tests/tempest/api/test_bgp_speaker_extensions.py b/neutron_dynamic_routing/tests/tempest/api/test_bgp_speaker_extensions.py index e39651fb..861d9c6b 100644 --- a/neutron_dynamic_routing/tests/tempest/api/test_bgp_speaker_extensions.py +++ b/neutron_dynamic_routing/tests/tempest/api/test_bgp_speaker_extensions.py @@ -14,6 +14,7 @@ import netaddr from tempest import config +from tempest.lib import decorators from tempest.lib import exceptions as lib_exc from tempest import test @@ -161,7 +162,7 @@ class BgpSpeakerTestJSON(BgpSpeakerTestJSONBase): Delete bgp-peer """ - @test.idempotent_id('df259771-7104-4ffa-b77f-bd183600d7f9') + @decorators.idempotent_id('df259771-7104-4ffa-b77f-bd183600d7f9') def test_delete_bgp_speaker(self): bgp_speaker = self.create_bgp_speaker(auto_delete=False, **self.default_bgp_speaker_args) @@ -171,11 +172,11 @@ class BgpSpeakerTestJSON(BgpSpeakerTestJSONBase): self.get_bgp_speaker, bgp_speaker_id) - @test.idempotent_id('81d9dc45-19f8-4c6e-88b8-401d965cd1b0') + @decorators.idempotent_id('81d9dc45-19f8-4c6e-88b8-401d965cd1b0') def test_create_bgp_peer(self): self.create_bgp_peer(**self.default_bgp_peer_args) - @test.idempotent_id('6ade0319-1ee2-493c-ac4b-5eb230ff3a77') + @decorators.idempotent_id('6ade0319-1ee2-493c-ac4b-5eb230ff3a77') def test_add_bgp_peer(self): bgp_speaker, bgp_peer = self.create_bgp_speaker_and_peer() bgp_speaker_id = bgp_speaker['id'] @@ -187,7 +188,7 @@ class BgpSpeakerTestJSON(BgpSpeakerTestJSONBase): self.assertEqual(1, len(bgp_peers_list)) self.assertTrue(bgp_peer_id in bgp_peers_list) - @test.idempotent_id('f9737708-1d79-440b-8350-779f97d882ee') + @decorators.idempotent_id('f9737708-1d79-440b-8350-779f97d882ee') def test_remove_bgp_peer(self): bgp_peer = self.create_bgp_peer(**self.default_bgp_peer_args) bgp_peer_id = bgp_peer['id'] @@ -203,7 +204,7 @@ class BgpSpeakerTestJSON(BgpSpeakerTestJSONBase): bgp_peers_list = bgp_speaker['peers'] self.assertTrue(not bgp_peers_list) - @test.idempotent_id('23c8eb37-d10d-4f43-b2e7-6542cb6a4405') + @decorators.idempotent_id('23c8eb37-d10d-4f43-b2e7-6542cb6a4405') def test_add_gateway_network(self): self.useFixture(fixtures.LockFixture('gateway_network_binding')) bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args) @@ -216,7 +217,7 @@ class BgpSpeakerTestJSON(BgpSpeakerTestJSONBase): self.assertEqual(1, len(network_list)) self.assertTrue(self.ext_net_id in network_list) - @test.idempotent_id('6cfc7137-0d99-4a3d-826c-9d1a3a1767b0') + @decorators.idempotent_id('6cfc7137-0d99-4a3d-826c-9d1a3a1767b0') def test_remove_gateway_network(self): self.useFixture(fixtures.LockFixture('gateway_network_binding')) bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args) @@ -233,7 +234,7 @@ class BgpSpeakerTestJSON(BgpSpeakerTestJSONBase): network_list = bgp_speaker['networks'] self.assertTrue(not network_list) - @test.idempotent_id('5bef22ad-5e70-4f7b-937a-dc1944642996') + @decorators.idempotent_id('5bef22ad-5e70-4f7b-937a-dc1944642996') def test_get_advertised_routes_null_address_scope(self): self.useFixture(fixtures.LockFixture('gateway_network_binding')) bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args) @@ -243,7 +244,7 @@ class BgpSpeakerTestJSON(BgpSpeakerTestJSONBase): routes = self.bgp_adm_client.get_bgp_advertised_routes(bgp_speaker_id) self.assertEqual(0, len(routes['advertised_routes'])) - @test.idempotent_id('cae9cdb1-ad65-423c-9604-d4cd0073616e') + @decorators.idempotent_id('cae9cdb1-ad65-423c-9604-d4cd0073616e') def test_get_advertised_routes_floating_ips(self): self.useFixture(fixtures.LockFixture('gateway_network_binding')) bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args) @@ -274,7 +275,7 @@ class BgpSpeakerTestJSON(BgpSpeakerTestJSONBase): self.assertEqual(floatingip['floating_ip_address'] + '/32', routes['advertised_routes'][0]['destination']) - @test.idempotent_id('c9ad566e-fe8f-4559-8303-bbad9062a30c') + @decorators.idempotent_id('c9ad566e-fe8f-4559-8303-bbad9062a30c') def test_get_advertised_routes_tenant_networks(self): self.useFixture(fixtures.LockFixture('gateway_network_binding')) addr_scope = self.create_address_scope('my-scope', ip_version=4) diff --git a/neutron_dynamic_routing/tests/tempest/api/test_bgp_speaker_extensions_negative.py b/neutron_dynamic_routing/tests/tempest/api/test_bgp_speaker_extensions_negative.py index 70ec9e61..bba6728d 100644 --- a/neutron_dynamic_routing/tests/tempest/api/test_bgp_speaker_extensions_negative.py +++ b/neutron_dynamic_routing/tests/tempest/api/test_bgp_speaker_extensions_negative.py @@ -14,6 +14,7 @@ import netaddr +from tempest.lib import decorators from tempest.lib import exceptions as lib_exc from tempest import test @@ -25,28 +26,28 @@ class BgpSpeakerTestJSONNegative(test_base.BgpSpeakerTestJSONBase): """Negative test cases asserting proper behavior of BGP API extension""" @test.attr(type=['negative', 'smoke']) - @test.idempotent_id('75e9ee2f-6efd-4320-bff7-ae24741c8b06') + @decorators.idempotent_id('75e9ee2f-6efd-4320-bff7-ae24741c8b06') def test_create_bgp_speaker_illegal_local_asn(self): self.assertRaises(lib_exc.BadRequest, self.create_bgp_speaker, local_as='65537') @test.attr(type=['negative', 'smoke']) - @test.idempotent_id('6742ec2e-382a-4453-8791-13a19b47cd13') + @decorators.idempotent_id('6742ec2e-382a-4453-8791-13a19b47cd13') def test_create_bgp_speaker_non_admin(self): self.assertRaises(lib_exc.Forbidden, self.bgp_client.create_bgp_speaker, {'bgp_speaker': self.default_bgp_speaker_args}) @test.attr(type=['negative', 'smoke']) - @test.idempotent_id('33f7aaf0-9786-478b-b2d1-a51086a50eb4') + @decorators.idempotent_id('33f7aaf0-9786-478b-b2d1-a51086a50eb4') def test_create_bgp_peer_non_admin(self): self.assertRaises(lib_exc.Forbidden, self.bgp_client.create_bgp_peer, {'bgp_peer': self.default_bgp_peer_args}) @test.attr(type=['negative', 'smoke']) - @test.idempotent_id('39435932-0266-4358-899b-0e9b1e53c3e9') + @decorators.idempotent_id('39435932-0266-4358-899b-0e9b1e53c3e9') def test_update_bgp_speaker_local_asn(self): bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args) bgp_speaker_id = bgp_speaker['id'] @@ -54,7 +55,7 @@ class BgpSpeakerTestJSONNegative(test_base.BgpSpeakerTestJSONBase): self.assertRaises(lib_exc.BadRequest, self.update_bgp_speaker, bgp_speaker_id, local_as='4321') - @test.idempotent_id('9cc33701-51e5-421f-a5d5-fd7b330e550f') + @decorators.idempotent_id('9cc33701-51e5-421f-a5d5-fd7b330e550f') def test_get_advertised_routes_tenant_networks(self): addr_scope1 = self.create_address_scope('my-scope1', ip_version=4) addr_scope2 = self.create_address_scope('my-scope2', ip_version=4)