From 62b75f1481d676e3cd2b2bf734fb0154b5f8b810 Mon Sep 17 00:00:00 2001 From: Volodymyr Shypyguzov Date: Tue, 7 Jun 2016 13:04:43 +0300 Subject: [PATCH] Refactor usage of template for detach-haproxy tests In case SEPARATE_SERVICE_HAPROXY_PLUGIN_PATH is set without MULTIPLE_NETWORKS we got local variable 'load_yaml' referenced before assignment Since this variable is added for all plugin tests it breaks them Partial-bug: 1589914 Change-Id: I8e2dc6f6074db6c3d45d73a102b5d9f9e9671f25 --- fuelweb_test/settings.py | 2 ++ fuelweb_test/tests/base_test_case.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fuelweb_test/settings.py b/fuelweb_test/settings.py index 2cfce4511..6ee3bb9bd 100644 --- a/fuelweb_test/settings.py +++ b/fuelweb_test/settings.py @@ -131,6 +131,8 @@ MULTIPLE_NETWORKS_TEMPLATE = os.environ.get( 'MULTIPLE_NETWORKS_TEMPLATE', os.path.join(os.getcwd(), 'system_test/tests_templates/tests_configs/multirack.yaml')) + +USE_HAPROXY_TEMPLATE = get_var_as_bool("USE_HAPROXY_TEMPLATE", False) EXTERNAL_HAPROXY_TEMPLATE = os.environ.get( 'EXTERNAL_HAPROXY_TEMPLATE', os.path.join(os.getcwd(), diff --git a/fuelweb_test/tests/base_test_case.py b/fuelweb_test/tests/base_test_case.py index 7e0a43bac..9e327d8a8 100644 --- a/fuelweb_test/tests/base_test_case.py +++ b/fuelweb_test/tests/base_test_case.py @@ -33,6 +33,7 @@ from fuelweb_test.settings import MULTIPLE_NETWORKS_TEMPLATE from fuelweb_test.settings import REPLACE_DEFAULT_REPOS from fuelweb_test.settings import REPLACE_DEFAULT_REPOS_ONLY_ONCE from fuelweb_test.settings import SEPARATE_SERVICE_HAPROXY_PLUGIN_PATH +from fuelweb_test.settings import USE_HAPROXY_TEMPLATE from gates_tests.helpers import exceptions @@ -346,7 +347,8 @@ class SetupEnvironment(TestBasic): if MULTIPLE_NETWORKS: from system_test.core.discover import load_yaml self._devops_config = load_yaml(MULTIPLE_NETWORKS_TEMPLATE) - if SEPARATE_SERVICE_HAPROXY_PLUGIN_PATH: + if USE_HAPROXY_TEMPLATE and SEPARATE_SERVICE_HAPROXY_PLUGIN_PATH: + from system_test.core.discover import load_yaml self._devops_config = load_yaml(EXTERNAL_HAPROXY_TEMPLATE) self.check_run("empty")