From e99b46953ade6d32ce660ae42f6b8d1e13f51624 Mon Sep 17 00:00:00 2001 From: madhusudhan-kandadai Date: Wed, 27 Jan 2016 14:16:56 -0800 Subject: [PATCH] Set config values and fix casual failing of nc service in scenario tests 1. Set the config values to make it work against non-devstack environment 2 Tweak webserver script, use nc "l" for listening to avoid clients to hang waiting for the connection close after the content has been served when using cirros 0.3.3 image. In Cirros 0.3.3, nc doesn't support "-ll" option for persistence listening Change-Id: Iecf70014f9444b226a0b08971e1c2ac26f653257 Closes-Bug: #1538746 --- .../tests/tempest/v2/scenario/base.py | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/neutron_lbaas/tests/tempest/v2/scenario/base.py b/neutron_lbaas/tests/tempest/v2/scenario/base.py index 0b8ee96e4..3f57af6ad 100644 --- a/neutron_lbaas/tests/tempest/v2/scenario/base.py +++ b/neutron_lbaas/tests/tempest/v2/scenario/base.py @@ -40,6 +40,27 @@ from neutron_lbaas.tests.tempest.v2.scenario import manager config = config.CONF +def _setup_config_args(auth_provider): + """Set up ServiceClient arguments using config settings. """ + service = config.network.catalog_type + region = config.network.region or config.identity.region + endpoint_type = config.network.endpoint_type + build_interval = config.network.build_interval + build_timeout = config.network.build_timeout + + # The disable_ssl appears in identity + disable_ssl_certificate_validation = ( + config.identity.disable_ssl_certificate_validation) + ca_certs = None + + # Trace in debug section + trace_requests = config.debug.trace_requests + + return [auth_provider, service, region, endpoint_type, build_interval, + build_timeout, disable_ssl_certificate_validation, ca_certs, + trace_requests] + + class BaseTestCase(manager.NetworkScenarioTest): def setUp(self): @@ -61,7 +82,7 @@ class BaseTestCase(manager.NetworkScenarioTest): mgr = self.get_client_manager() auth_provider = mgr.auth_provider - self.client_args = [auth_provider, 'network', 'regionOne'] + self.client_args = _setup_config_args(auth_provider) self.load_balancers_client = ( load_balancers_client.LoadBalancersClientJSON(*self.client_args)) @@ -225,9 +246,8 @@ class BaseTestCase(manager.NetworkScenarioTest): username, key.name) # Start netcat - start_server = ('while true; do ' - 'sudo nc -ll -p %(port)s -e sh /tmp/%(script)s; ' - 'done > /dev/null &') + start_server = ('while true; do sudo sh /tmp/%(script)s ' + '| sudo nc -l -p %(port)s; done > /dev/null &') cmd = start_server % {'port': self.port1, 'script': 'script1'} ssh_client.exec_command(cmd)