aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-06-29 10:06:19 +0000
committerCedric Ollivier <cedric.ollivier@orange.com>2017-07-05 14:30:04 +0000
commit11ef4c749460411d25777bdd3e447fc03af65208 (patch)
tree2051473f012149c32ecb450fb32901ccd820922b
parentb4cacd1ca87b7cbe7c166a543e8f448b723c837d (diff)
Enable refstack work on https without SSL checks
When refstack is run in https environment, SSL checks will be skipped if no cacert file is provided. JIRA: FUNCTEST-828 Change-Id: Ib44582b4f2f508c7a255a1510dbdc33110fe0f14 Signed-off-by: Linda Wang <wangwulin@huawei.com>
-rw-r--r--functest/opnfv_tests/openstack/refstack_client/refstack_client.py17
-rw-r--r--functest/tests/unit/openstack/refstack_client/test_refstack_client.py25
-rw-r--r--functest/utils/env.py3
3 files changed, 32 insertions, 13 deletions
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
index 9edbab5a..c2a05379 100644
--- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
+++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
@@ -44,19 +44,20 @@ class RefstackClient(testcase.OSGCTestCase):
self.CONF_PATH)
self.defcorelist = pkg_resources.resource_filename(
'functest', 'opnfv_tests/openstack/refstack_client/defcore.txt')
+ self.insecure = ''
+ if ('https' in CONST.__getattribute__('OS_AUTH_URL') and
+ CONST.__getattribute__('OS_INSECURE').lower() == 'true'):
+ self.insecure = '-k'
def run_defcore(self, conf, testlist):
- logger.debug("Generating test case list...")
-
- cmd = ("refstack-client test -c {0} -v --test-list {1}"
- .format(conf, testlist))
+ cmd = ("refstack-client test {0} -c {1} -v --test-list {2}"
+ .format(self.insecure, conf, testlist))
+ logger.info("Starting Refstack_defcore test case: '%s'." % cmd)
ft_utils.execute_command(cmd)
def run_defcore_default(self):
- logger.debug("Generating test case list...")
-
- cmd = ("refstack-client test -c {0} -v --test-list {1}"
- .format(self.confpath, self.defcorelist))
+ cmd = ("refstack-client test {0} -c {1} -v --test-list {2}"
+ .format(self.insecure, self.confpath, self.defcorelist))
logger.info("Starting Refstack_defcore test case: '%s'." % cmd)
header = ("Refstack environment:\n"
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 f92d2806..51dbb640 100644
--- a/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
+++ b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
@@ -13,6 +13,7 @@ import unittest
from functest.core import testcase
from functest.opnfv_tests.openstack.refstack_client import refstack_client
+from functest.utils.constants import CONST
class OSRefstackClientTesting(unittest.TestCase):
@@ -21,23 +22,39 @@ class OSRefstackClientTesting(unittest.TestCase):
'functest',
'opnfv_tests/openstack/refstack_client/refstack_tempest.conf')
_testlist = pkg_resources.resource_filename(
- 'functest', 'opnfv_tests/openstack/refstack_client/defcore.txt')
+ 'functest', 'opnfv_tests/openstack/refstack_client/defcore.txt')
def setUp(self):
self.defaultargs = {'config': self._config,
'testlist': self._testlist}
+ CONST.__setattr__('OS_AUTH_URL', 'https://ip:5000/v3')
+ CONST.__setattr__('OS_INSECURE', 'true')
self.refstackclient = refstack_client.RefstackClient()
- def test_run_defcore(self):
+ def test_run_defcore_insecure(self):
+ insecure = '-k'
config = 'tempest.conf'
testlist = 'testlist'
with mock.patch('functest.opnfv_tests.openstack.refstack_client.'
'refstack_client.ft_utils.execute_command') as m:
- cmd = ("refstack-client test -c {0} -v --test-list {1}"
- .format(config, testlist))
+ cmd = ("refstack-client test {0} -c {1} -v --test-list {2}"
+ .format(insecure, config, testlist))
self.refstackclient.run_defcore(config, testlist)
m.assert_any_call(cmd)
+ def test_run_defcore(self):
+ CONST.__setattr__('OS_AUTH_URL', 'http://ip:5000/v3')
+ refstackclient = refstack_client.RefstackClient()
+ insecure = ''
+ config = 'tempest.conf'
+ testlist = 'testlist'
+ with mock.patch('functest.opnfv_tests.openstack.refstack_client.'
+ 'refstack_client.ft_utils.execute_command') as m:
+ cmd = ("refstack-client test {0} -c {1} -v --test-list {2}"
+ .format(insecure, config, testlist))
+ refstackclient.run_defcore(config, testlist)
+ m.assert_any_call(cmd)
+
def _get_main_kwargs(self, key=None):
kwargs = {'config': self._config,
'testlist': self._testlist}
diff --git a/functest/utils/env.py b/functest/utils/env.py
index 0174588d..2fb766d3 100644
--- a/functest/utils/env.py
+++ b/functest/utils/env.py
@@ -18,7 +18,8 @@ default_envs = {
'OS_ENDPOINT_TYPE': None,
'OS_AUTH_URL': None,
'CONFIG_FUNCTEST_YAML': pkg_resources.resource_filename(
- 'functest', 'ci/config_functest.yaml')
+ 'functest', 'ci/config_functest.yaml'),
+ 'OS_INSECURE': ''
}