Allow LBaas integration tests to dynamically skip
lbaas v1 and v2 are mutually exclusive and cannot be enabled at the same time within devstack. The current integation test goes after the existing lbaas v1 resources with a devstack setup with the q-lbaas service. This patch allow the test itself to be smart enough to skip itself when the required lbaas version is not available. The current infra gate job template is hardcoded to only enable lbaas v1 (q-lbaas), so the v1 test will continue to work properly and the new v2 test (wip) will be dynamically skipped. A follow up patch will modify the infra gate job template, {pipeline}-heat-dsvm-functional-{engine}-{datastore}{branch-designator}, to also include an lbaas version. Then the job can setup either a lbaas v1 or v2 devstack so both tests can be run. Another follow up patch will flush out the lbaas v2 integration test once the new resources have been merged. blueprint: lbaasv2-suport Change-Id: I0e4c83f1b078451607a30e8b665e309ea5e170d1
This commit is contained in:
parent
588c85a5af
commit
68c54de80b
@ -18,6 +18,7 @@ import time
|
||||
|
||||
import fixtures
|
||||
from heatclient import exc as heat_exceptions
|
||||
from neutronclient.common import exceptions as network_exceptions
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
@ -175,6 +176,13 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
|
||||
if net['name'] == net_name:
|
||||
return net
|
||||
|
||||
def is_network_extension_supported(self, extension_alias):
|
||||
try:
|
||||
self.network_client.show_extension(extension_alias)
|
||||
except network_exceptions.NeutronClientException:
|
||||
return False
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def _stack_output(stack, output_key, validate_errors=True):
|
||||
"""Return a stack output value for a given key."""
|
||||
|
@ -20,7 +20,7 @@ from heat_integrationtests.scenario import scenario_base
|
||||
|
||||
|
||||
class AutoscalingLoadBalancerTest(scenario_base.ScenarioTestsBase):
|
||||
"""The class is responsible for testing ASG + LB scenario.
|
||||
"""The class is responsible for testing ASG + LBv1 scenario.
|
||||
|
||||
The very common use case tested is an autoscaling group
|
||||
of some web application servers behind a loadbalancer.
|
||||
@ -31,6 +31,8 @@ class AutoscalingLoadBalancerTest(scenario_base.ScenarioTestsBase):
|
||||
self.template_name = 'test_autoscaling_lb_neutron.yaml'
|
||||
self.app_server_template_name = 'app_server_neutron.yaml'
|
||||
self.webapp_template_name = 'netcat-webapp.yaml'
|
||||
if not self.is_network_extension_supported('lbaas'):
|
||||
self.skipTest('LBaas v1 extension not available, skipping')
|
||||
|
||||
def check_num_responses(self, url, expected_num, retries=10):
|
||||
resp = set()
|
||||
@ -51,7 +53,7 @@ class AutoscalingLoadBalancerTest(scenario_base.ScenarioTestsBase):
|
||||
return all_res and all_res_complete
|
||||
|
||||
def test_autoscaling_loadbalancer_neutron(self):
|
||||
"""Check work of AutoScaing and Neutron LBaaS resource in Heat.
|
||||
"""Check work of AutoScaing and Neutron LBaaS v1 resource in Heat.
|
||||
|
||||
The scenario is the following:
|
||||
1. Launch a stack with a load balancer and autoscaling group
|
||||
|
47
heat_integrationtests/scenario/test_autoscaling_lbv2.py
Normal file
47
heat_integrationtests/scenario/test_autoscaling_lbv2.py
Normal file
@ -0,0 +1,47 @@
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from heat_integrationtests.scenario import scenario_base
|
||||
|
||||
|
||||
class AutoscalingLoadBalancerv2Test(scenario_base.ScenarioTestsBase):
|
||||
"""The class is responsible for testing ASG + LBv2 scenario.
|
||||
|
||||
The very common use case tested is an autoscaling group
|
||||
of some web application servers behind a loadbalancer.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(AutoscalingLoadBalancerv2Test, self).setUp()
|
||||
self.template_name = 'test_autoscaling_lbv2_neutron.yaml'
|
||||
self.app_server_template_name = 'app_server_lbv2_neutron.yaml'
|
||||
self.webapp_template_name = 'netcat-webapp.yaml'
|
||||
if not self.is_network_extension_supported('lbaasv2'):
|
||||
self.skipTest('LBaasv2 extension not available, skipping')
|
||||
|
||||
def test_autoscaling_loadbalancer_neutron(self):
|
||||
"""Check work of AutoScaing and Neutron LBaaS v2 resource in Heat.
|
||||
|
||||
The scenario is the following:
|
||||
1. Launch a stack with a load balancer and autoscaling group
|
||||
of one server, wait until stack create is complete.
|
||||
2. Check that there is only one distinctive response from
|
||||
loadbalanced IP.
|
||||
3. Signal the scale_up policy, wait until all resources in
|
||||
autoscaling group are complete.
|
||||
4. Check that now there are two distinctive responses from
|
||||
loadbalanced IP.
|
||||
"""
|
||||
|
||||
# TODO(MRV): Place holder for AutoScaing and Neutron LBaaS v2 test
|
||||
pass
|
Loading…
Reference in New Issue
Block a user