Adapt protocol and skip tests depending on config

Load balancer providers may not support the HTTP protocol, L7
policies/rules or health monitors. Here we fallback to whichever L4
protocol is set in the tempest config if HTTP is not available and skip
L7 and health monitor tests if not supported.

Change-Id: I9a1512c6ce9a017a7a48ce78fc8f51ff8f17f092
This commit is contained in:
Carlos Goncalves 2019-03-14 13:16:20 +01:00
parent 1f0f4ef028
commit 3bfe791b50
1 changed files with 13 additions and 2 deletions

View File

@ -73,10 +73,15 @@ class TrafficOperationsScenarioTest(test_base.LoadBalancerBaseTestWithCompute):
CONF.load_balancer.lb_build_interval,
CONF.load_balancer.lb_build_timeout)
protocol = const.HTTP
lb_feature_enabled = CONF.loadbalancer_feature_enabled
if not lb_feature_enabled.l7_protocol_enabled:
protocol = lb_feature_enabled.l4_protocol
listener_name = data_utils.rand_name("lb_member_listener1_operations")
listener_kwargs = {
const.NAME: listener_name,
const.PROTOCOL: const.HTTP,
const.PROTOCOL: protocol,
const.PROTOCOL_PORT: '80',
const.LOADBALANCER_ID: cls.lb_id,
}
@ -96,7 +101,7 @@ class TrafficOperationsScenarioTest(test_base.LoadBalancerBaseTestWithCompute):
pool_name = data_utils.rand_name("lb_member_pool1_operations")
pool_kwargs = {
const.NAME: pool_name,
const.PROTOCOL: const.HTTP,
const.PROTOCOL: protocol,
const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
const.LISTENER_ID: cls.listener_id,
}
@ -173,6 +178,9 @@ class TrafficOperationsScenarioTest(test_base.LoadBalancerBaseTestWithCompute):
# Send some traffic
self.check_members_balanced(self.lb_vip_address)
@testtools.skipUnless(
CONF.loadbalancer_feature_enabled.health_monitor_enabled,
'Health monitor testing is disabled')
@decorators.idempotent_id('a16f8eb4-a77c-4b0e-8b1b-91c237039713')
def test_healthmonitor_traffic(self):
"""Tests traffic is correctly routed based on healthmonitor status
@ -385,6 +393,9 @@ class TrafficOperationsScenarioTest(test_base.LoadBalancerBaseTestWithCompute):
# Send some traffic and verify it is balanced again
self.check_members_balanced(self.lb_vip_address)
@testtools.skipUnless(
CONF.loadbalancer_feature_enabled.l7_protocol_enabled,
'L7 protocol testing is disabled')
@decorators.idempotent_id('3558186d-6dcd-4d9d-b7f7-adc190b66149')
def test_l7policies_and_l7rules(self):
"""Tests sending traffic through a loadbalancer with l7rules