summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2018-02-13 03:05:24 +0000
committerLinda Wang <wangwulin@huawei.com>2018-02-13 03:38:36 +0000
commit26a736ea4414616f509b4a161fe06970df832436 (patch)
tree792d3f436daea7fc8af690e91e6e2ce89240517a
parent7598ab763d31ca4f901043722c19635b73f00d3f (diff)
Export env vars instead of CONST in refstack
JIRA: FUNCTEST-930 Change-Id: I7f28ee0b9a55c53a11f03509c3f9e8eb37cc43a9 Signed-off-by: Linda Wang <wangwulin@huawei.com>
-rw-r--r--functest/opnfv_tests/openstack/refstack_client/refstack_client.py11
-rw-r--r--functest/tests/unit/openstack/refstack_client/test_refstack_client.py8
2 files changed, 9 insertions, 10 deletions
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
index 4e8f58b62..cb2ba2208 100644
--- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
+++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
@@ -26,7 +26,6 @@ from functest.energy import energy
from functest.opnfv_tests.openstack.refstack_client.tempest_conf \
import TempestConf
from functest.opnfv_tests.openstack.tempest import conf_utils
-from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
__author__ = ("Matthew Li <matthew.lijun@huawei.com>,"
@@ -58,8 +57,8 @@ class RefstackClient(testcase.TestCase):
'functest', 'opnfv_tests/openstack/refstack_client/defcore.txt')
self.testlist = None
self.insecure = ''
- if ('https' in CONST.__getattribute__('OS_AUTH_URL') and
- CONST.__getattribute__('OS_INSECURE').lower() == 'true'):
+ if ('https' in os.environ['OS_AUTH_URL'] and
+ os.getenv('OS_INSECURE', '').lower() == 'true'):
self.insecure = '-k'
def generate_conf(self):
@@ -89,9 +88,9 @@ class RefstackClient(testcase.TestCase):
f_env.write(
("Refstack environment:\n"
" SUT: {}\n Scenario: {}\n Node: {}\n Date: {}\n")
- .format(CONST.__getattribute__('INSTALLER_TYPE'),
- CONST.__getattribute__('DEPLOY_SCENARIO'),
- CONST.__getattribute__('NODE_NAME'),
+ .format(os.getenv('INSTALLER_TYPE', None),
+ os.getenv('DEPLOY_SCENARIO', None),
+ os.getenv('NODE_NAME', 'unknown_pod'),
time.strftime("%a %b %d %H:%M:%S %Z %Y")))
with open(os.path.join(conf_utils.REFSTACK_RESULTS_DIR,
diff --git a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
index a7a914cbe..e2e7dcebc 100644
--- a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
+++ b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
@@ -10,6 +10,7 @@
# pylint: disable=missing-docstring
import logging
+import os
import unittest
import mock
@@ -18,7 +19,6 @@ import pkg_resources
from functest.core import testcase
from functest.opnfv_tests.openstack.refstack_client.refstack_client import \
RefstackClient, RefstackClientParser
-from functest.utils.constants import CONST
from snaps.openstack.os_credentials import OSCreds
@@ -39,8 +39,8 @@ class OSRefstackClientTesting(unittest.TestCase):
def setUp(self):
self.default_args = {'config': self._config,
'testlist': self._testlist}
- CONST.__setattr__('OS_AUTH_URL', 'https://ip:5000/v3')
- CONST.__setattr__('OS_INSECURE', 'true')
+ os.environ['OS_AUTH_URL'] = 'https://ip:5000/v3'
+ os.environ['OS_INSECURE'] = 'true'
self.case_name = 'refstack_defcore'
self.result = 0
self.os_creds = OSCreds(
@@ -70,7 +70,7 @@ class OSRefstackClientTesting(unittest.TestCase):
m_cmd.assert_any_call(cmd)
def test_run_defcore(self):
- CONST.__setattr__('OS_AUTH_URL', 'http://ip:5000/v3')
+ os.environ['OS_AUTH_URL'] = 'http://ip:5000/v3'
insecure = ''
config = 'tempest.conf'
testlist = 'testlist'