From ea2440d631015a653b6982a79df25489a98b000b Mon Sep 17 00:00:00 2001 From: mouad benchchaoui Date: Sun, 22 Dec 2013 00:38:06 +0100 Subject: [PATCH] Make testing neutron agents optional Closes-Bug: #1247778 Change-Id: Ia67213d661a8dd3b64ca7a7e596e10d3eeba71dc --- tempest/api/network/test_load_balancer.py | 27 ++++++++++--------- tempest/api/network/test_vpnaas_extensions.py | 17 +++++++----- tempest/cli/simple_read_only/test_neutron.py | 2 ++ 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/tempest/api/network/test_load_balancer.py b/tempest/api/network/test_load_balancer.py index 7e4ec37eb7..1f4b37882b 100644 --- a/tempest/api/network/test_load_balancer.py +++ b/tempest/api/network/test_load_balancer.py @@ -17,7 +17,7 @@ from tempest.api.network import base from tempest.common.utils import data_utils -from tempest.test import attr +from tempest import test class LoadBalancerJSON(base.BaseNetworkTest): @@ -42,6 +42,9 @@ class LoadBalancerJSON(base.BaseNetworkTest): @classmethod def setUpClass(cls): super(LoadBalancerJSON, cls).setUpClass() + if not test.is_extension_enabled('lbaas', 'network'): + msg = "lbaas extension not enabled." + raise cls.skipException(msg) cls.network = cls.create_network() cls.name = cls.network['name'] cls.subnet = cls.create_subnet(cls.network) @@ -53,7 +56,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): cls.member = cls.create_member(80, cls.pool) cls.health_monitor = cls.create_health_monitor(4, 3, "TCP", 1) - @attr(type='smoke') + @test.attr(type='smoke') def test_list_vips(self): # Verify the vIP exists in the list of all vIPs resp, body = self.client.list_vips() @@ -97,7 +100,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): resp, body = self.client.delete_pool(pool['id']) self.assertEqual('204', resp['status']) - @attr(type='smoke') + @test.attr(type='smoke') def test_show_vip(self): # Verifies the details of a vip resp, body = self.client.show_vip(self.vip['id']) @@ -106,7 +109,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): self.assertEqual(self.vip['id'], vip['id']) self.assertEqual(self.vip['name'], vip['name']) - @attr(type='smoke') + @test.attr(type='smoke') def test_show_pool(self): # Verifies the details of a pool resp, body = self.client.show_pool(self.pool['id']) @@ -115,7 +118,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): self.assertEqual(self.pool['id'], pool['id']) self.assertEqual(self.pool['name'], pool['name']) - @attr(type='smoke') + @test.attr(type='smoke') def test_list_pools(self): # Verify the pool exists in the list of all pools resp, body = self.client.list_pools() @@ -123,7 +126,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): pools = body['pools'] self.assertIn(self.pool['id'], [p['id'] for p in pools]) - @attr(type='smoke') + @test.attr(type='smoke') def test_list_members(self): # Verify the member exists in the list of all members resp, body = self.client.list_members() @@ -131,7 +134,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): members = body['members'] self.assertIn(self.member['id'], [m['id'] for m in members]) - @attr(type='smoke') + @test.attr(type='smoke') def test_create_update_delete_member(self): # Creates a member resp, body = self.client.create_member("10.0.9.47", 80, @@ -148,7 +151,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): resp, body = self.client.delete_member(member['id']) self.assertEqual('204', resp['status']) - @attr(type='smoke') + @test.attr(type='smoke') def test_show_member(self): # Verifies the details of a member resp, body = self.client.show_member(self.member['id']) @@ -158,7 +161,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): self.assertEqual(self.member['admin_state_up'], member['admin_state_up']) - @attr(type='smoke') + @test.attr(type='smoke') def test_list_health_monitors(self): # Verify the health monitor exists in the list of all health monitors resp, body = self.client.list_health_monitors() @@ -167,7 +170,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): self.assertIn(self.health_monitor['id'], [h['id'] for h in health_monitors]) - @attr(type='smoke') + @test.attr(type='smoke') def test_create_update_delete_health_monitor(self): # Creates a health_monitor resp, body = self.client.create_health_monitor(4, 3, "TCP", 1) @@ -184,7 +187,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): resp, body = self.client.delete_health_monitor(health_monitor['id']) self.assertEqual('204', resp['status']) - @attr(type='smoke') + @test.attr(type='smoke') def test_show_health_monitor(self): # Verifies the details of a health_monitor resp, body = self.client.show_health_monitor(self.health_monitor['id']) @@ -194,7 +197,7 @@ class LoadBalancerJSON(base.BaseNetworkTest): self.assertEqual(self.health_monitor['admin_state_up'], health_monitor['admin_state_up']) - @attr(type='smoke') + @test.attr(type='smoke') def test_associate_disassociate_health_monitor_with_pool(self): # Verify that a health monitor can be associated with a pool resp, body = (self.client.associate_health_monitor_with_pool diff --git a/tempest/api/network/test_vpnaas_extensions.py b/tempest/api/network/test_vpnaas_extensions.py index fc3b1d93c0..d196886599 100644 --- a/tempest/api/network/test_vpnaas_extensions.py +++ b/tempest/api/network/test_vpnaas_extensions.py @@ -17,7 +17,7 @@ from tempest.api.network import base from tempest.common.utils import data_utils -from tempest.test import attr +from tempest import test class VPNaaSJSON(base.BaseNetworkTest): @@ -38,6 +38,9 @@ class VPNaaSJSON(base.BaseNetworkTest): @classmethod def setUpClass(cls): super(VPNaaSJSON, cls).setUpClass() + if not test.is_extension_enabled('vpnaas', 'network'): + msg = "vpnaas extension not enabled." + raise cls.skipException(msg) cls.network = cls.create_network() cls.subnet = cls.create_subnet(cls.network) cls.router = cls.create_router( @@ -65,7 +68,7 @@ class VPNaaSJSON(base.BaseNetworkTest): ike_id_list.append(i['id']) self.assertNotIn(ike_policy_id, ike_id_list) - @attr(type='smoke') + @test.attr(type='smoke') def test_list_vpn_services(self): # Verify the VPN service exists in the list of all VPN services resp, body = self.client.list_vpnservices() @@ -73,7 +76,7 @@ class VPNaaSJSON(base.BaseNetworkTest): vpnservices = body['vpnservices'] self.assertIn(self.vpnservice['id'], [v['id'] for v in vpnservices]) - @attr(type='smoke') + @test.attr(type='smoke') def test_create_update_delete_vpn_service(self): # Creates a VPN service name = data_utils.rand_name('vpn-service-') @@ -102,7 +105,7 @@ class VPNaaSJSON(base.BaseNetworkTest): vpn_services = [vs['id'] for vs in body['vpnservices']] self.assertNotIn(vpnservice['id'], vpn_services) - @attr(type='smoke') + @test.attr(type='smoke') def test_show_vpn_service(self): # Verifies the details of a vpn service resp, body = self.client.show_vpnservice(self.vpnservice['id']) @@ -116,7 +119,7 @@ class VPNaaSJSON(base.BaseNetworkTest): self.assertEqual(self.vpnservice['subnet_id'], vpnservice['subnet_id']) self.assertEqual(self.vpnservice['tenant_id'], vpnservice['tenant_id']) - @attr(type='smoke') + @test.attr(type='smoke') def test_list_ike_policies(self): # Verify the ike policy exists in the list of all IKE policies resp, body = self.client.list_ikepolicies() @@ -124,7 +127,7 @@ class VPNaaSJSON(base.BaseNetworkTest): ikepolicies = body['ikepolicies'] self.assertIn(self.ikepolicy['id'], [i['id'] for i in ikepolicies]) - @attr(type='smoke') + @test.attr(type='smoke') def test_create_update_delete_ike_policy(self): # Creates a IKE policy name = data_utils.rand_name('ike-policy-') @@ -149,7 +152,7 @@ class VPNaaSJSON(base.BaseNetworkTest): resp, body = self.client.delete_ikepolicy(ikepolicy['id']) self.assertEqual('204', resp['status']) - @attr(type='smoke') + @test.attr(type='smoke') def test_show_ike_policy(self): # Verifies the details of a ike policy resp, body = self.client.show_ikepolicy(self.ikepolicy['id']) diff --git a/tempest/cli/simple_read_only/test_neutron.py b/tempest/cli/simple_read_only/test_neutron.py index 80376abd79..61ffc2546f 100644 --- a/tempest/cli/simple_read_only/test_neutron.py +++ b/tempest/cli/simple_read_only/test_neutron.py @@ -76,11 +76,13 @@ class SimpleReadOnlyNeutronClientTest(tempest.cli.ClientTestBase): @test.skip_because(bug="1240694") @test.attr(type='smoke') + @test.requires_ext(extension='metering', service='network') def test_neutron_meter_label_list(self): self.neutron('meter-label-list') @test.skip_because(bug="1240694") @test.attr(type='smoke') + @test.requires_ext(extension='metering', service='network') def test_neutron_meter_label_rule_list(self): self.neutron('meter-label-rule-list')