summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/Dockerfile2
-rw-r--r--docker/Dockerfile.aarch642
-rw-r--r--docs/com/pres/framework/framework.md3
-rw-r--r--functest/ci/config_aarch64_patch.yaml3
-rw-r--r--functest/ci/config_functest.yaml2
-rw-r--r--functest/ci/config_patch.yaml3
-rwxr-xr-xfunctest/ci/prepare_env.py17
-rw-r--r--functest/cli/commands/cli_env.py27
-rwxr-xr-xfunctest/opnfv_tests/sdn/odl/odl.py8
-rw-r--r--functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py3
-rw-r--r--functest/tests/unit/ci/test_prepare_env.py23
-rw-r--r--functest/tests/unit/utils/test_decorators.py19
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py70
-rw-r--r--functest/utils/decorators.py7
-rw-r--r--functest/utils/functest_utils.py20
15 files changed, 106 insertions, 103 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 21ae33437..ff532ccc6 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -66,7 +66,7 @@ sshpass \
wget \
--no-install-recommends
-RUN pip install --upgrade pip
+RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0
RUN mkdir -p ${REPOS_DIR} \
&& mkdir -p ${REPOS_VNFS_DIR} \
diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64
index 729646119..44e6904b1 100644
--- a/docker/Dockerfile.aarch64
+++ b/docker/Dockerfile.aarch64
@@ -65,7 +65,7 @@ sshpass \
wget \
--no-install-recommends
-RUN pip install --upgrade pip
+RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0
RUN mkdir -p ${REPOS_DIR} \
&& mkdir -p ${REPOS_VNFS_DIR} \
diff --git a/docs/com/pres/framework/framework.md b/docs/com/pres/framework/framework.md
index d6a01de06..dfd7a2155 100644
--- a/docs/com/pres/framework/framework.md
+++ b/docs/com/pres/framework/framework.md
@@ -2,7 +2,7 @@
created by [Cédric Ollivier](mailto:cedric.ollivier@orange.com)
-2017/05/06
+2017/06/05
Note:
@@ -313,7 +313,6 @@ run:
- __to finish VNF abstraction (coverage + pylint)__
- to publish doc API
-- to manage criteria as written in testcases.yaml
Please see [Functest Euphrates page](https://wiki.opnfv.org/display/functest/Functest+Euphrates+page) for more details
diff --git a/functest/ci/config_aarch64_patch.yaml b/functest/ci/config_aarch64_patch.yaml
index cd395ab89..80cf4ccc2 100644
--- a/functest/ci/config_aarch64_patch.yaml
+++ b/functest/ci/config_aarch64_patch.yaml
@@ -16,6 +16,9 @@ os:
vping:
image_name: TestVM
+ tempest:
+ use_custom_images: False
+
odl_sfc:
image_base_url: "http://artifacts.opnfv.org/sfc/demo"
image_name: sfc_nsh_danube
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index 96147819a..1b2c83800 100644
--- a/functest/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -139,7 +139,7 @@ tempest:
private_subnet_name: tempest-subnet
private_subnet_cidr: 192.168.150.0/24
router_name: tempest-router
- use_custom_images: False
+ use_custom_images: True
use_custom_flavors: False
volume_device_name: vdc
diff --git a/functest/ci/config_patch.yaml b/functest/ci/config_patch.yaml
index d47766b64..ad8b0889f 100644
--- a/functest/ci/config_patch.yaml
+++ b/functest/ci/config_patch.yaml
@@ -13,16 +13,13 @@ fdio:
flavor_extra_specs: {'hw:mem_page_size':'large'}
image_properties: {'hw_mem_page_size':'large'}
tempest:
- use_custom_images: True
use_custom_flavors: True
ovs:
general:
flavor_extra_specs: {'hw:mem_page_size':'large'}
image_properties: {'hw_mem_page_size':'large'}
tempest:
- use_custom_images: True
use_custom_flavors: True
multisite:
tempest:
- use_custom_images: True
use_custom_flavors: True
diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py
index 8e17a4fcc..e03bc6547 100755
--- a/functest/ci/prepare_env.py
+++ b/functest/ci/prepare_env.py
@@ -234,12 +234,15 @@ def source_rc_file():
CONST.__setattr__('OS_PASSWORD', value)
-def patch_config_file():
+def update_config_file():
patch_file(CONFIG_PATCH_PATH)
if pod_arch and pod_arch in arch_filter:
patch_file(CONFIG_AARCH64_PATCH_PATH)
+ if "TEST_DB_URL" in os.environ:
+ update_db_url()
+
def patch_file(patch_file_path):
logger.debug('Updating file: %s', patch_file_path)
@@ -257,7 +260,15 @@ def patch_file(patch_file_path):
os.remove(CONFIG_FUNCTEST_PATH)
with open(CONFIG_FUNCTEST_PATH, "w") as f:
f.write(yaml.dump(new_functest_yaml, default_style='"'))
- f.close()
+
+
+def update_db_url():
+ with open(CONFIG_FUNCTEST_PATH) as f:
+ functest_yaml = yaml.safe_load(f)
+
+ with open(CONFIG_FUNCTEST_PATH, "w") as f:
+ functest_yaml["results"]["test_db_url"] = os.environ.get('TEST_DB_URL')
+ f.write(yaml.dump(functest_yaml, default_style='"'))
def verify_deployment():
@@ -381,7 +392,7 @@ def main(**kwargs):
get_deployment_handler()
create_directories()
source_rc_file()
- patch_config_file()
+ update_config_file()
verify_deployment()
install_rally()
install_tempest()
diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py
index f5ba4b342..b43116fcd 100644
--- a/functest/cli/commands/cli_env.py
+++ b/functest/cli/commands/cli_env.py
@@ -11,6 +11,7 @@ import os
import click
import git
+import prettytable
from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
@@ -66,21 +67,19 @@ class CliEnv(object):
if self.status(verbose=False) == 0:
STATUS = "ready"
- click.echo("+======================================================+")
- click.echo("| Functest Environment info |")
- click.echo("+======================================================+")
- click.echo("| INSTALLER: %s|" % installer_info.ljust(41))
- click.echo("| SCENARIO: %s|" % scenario.ljust(41))
- click.echo("| POD: %s|" % node.ljust(41))
- click.echo("| GIT BRACNH: %s|" % git_branch.ljust(41))
- click.echo("| GIT HASH: %s|" % git_hash.ljust(41))
+ msg = prettytable.PrettyTable(
+ header_style='upper', padding_width=5,
+ field_names=['Functest Environment', 'value'])
+ msg.add_row(['INSTALLER', installer_info])
+ msg.add_row(['SCENARIO', scenario])
+ msg.add_row(['POD', node])
+ msg.add_row(['GIT BRANCH', git_branch])
+ msg.add_row(['GIT HASH', git_hash])
if build_tag:
- click.echo("| BUILD TAG: %s|" % build_tag.ljust(41))
- click.echo("| DEBUG FLAG: %s|" % is_debug.ljust(41))
- click.echo("+------------------------------------------------------+")
- click.echo("| STATUS: %s|" % STATUS.ljust(41))
- click.echo("+------------------------------------------------------+")
- click.echo("")
+ msg.add_row(['BUILD TAG', build_tag])
+ msg.add_row(['DEBUG FLAG', is_debug])
+ msg.add_row(['STATUS', STATUS])
+ click.echo(msg.get_string())
def status(self, verbose=True):
ret_val = 0
diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index b2b0b77c6..fb5dcbc6e 100755
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -34,6 +34,7 @@ from six import StringIO
from six.moves import urllib
from functest.core import testcase
+from functest.utils import constants
import functest.utils.openstack_utils as op_utils
__author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
@@ -65,14 +66,15 @@ class ODLResultVisitor(robot.api.ResultVisitor):
class ODLTests(testcase.TestCase):
"""ODL test runner."""
- repos = "/home/opnfv/repos/"
- odl_test_repo = os.path.join(repos, "odl_test")
+ odl_test_repo = os.path.join(
+ constants.CONST.__getattribute__('dir_repos'), 'odl_test')
neutron_suite_dir = os.path.join(odl_test_repo,
"csit/suites/openstack/neutron")
basic_suite_dir = os.path.join(odl_test_repo,
"csit/suites/integration/basic")
default_suites = [basic_suite_dir, neutron_suite_dir]
- res_dir = '/home/opnfv/functest/results/odl/'
+ res_dir = os.path.join(
+ constants.CONST.__getattribute__('dir_results'), 'odl')
__logger = logging.getLogger(__name__)
@classmethod
diff --git a/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py b/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
index f9eee7af6..aed98ee48 100644
--- a/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
+++ b/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
@@ -18,7 +18,6 @@ import re
import time
from functest.utils.constants import CONST
-import functest.utils.functest_utils as ft_utils
class Foundation(object):
@@ -55,7 +54,7 @@ class Foundation(object):
"""
Get Default Parameters value
"""
- self.Result_DB = ft_utils.get_db_url()
+ self.Result_DB = CONST.__getattribute__("results_test_db_url")
self.masterusername = CONST.__getattribute__('ONOS_onosbench_username')
self.masterpassword = CONST.__getattribute__('ONOS_onosbench_password')
self.agentusername = CONST.__getattribute__('ONOS_onoscli_username')
diff --git a/functest/tests/unit/ci/test_prepare_env.py b/functest/tests/unit/ci/test_prepare_env.py
index 513e72308..85d1918d8 100644
--- a/functest/tests/unit/ci/test_prepare_env.py
+++ b/functest/tests/unit/ci/test_prepare_env.py
@@ -20,6 +20,7 @@ class PrepareEnvTesting(unittest.TestCase):
def setUp(self):
self.prepare_envparser = prepare_env.PrepareEnvParser()
+ self.db_url_env = 'http://foo/testdb'
@mock.patch('functest.ci.prepare_env.logger.info')
def test_print_separator(self, mock_logger_info):
@@ -297,6 +298,22 @@ class PrepareEnvTesting(unittest.TestCase):
prepare_env.patch_file('test_file')
self.assertTrue(m.called)
+ @mock.patch('functest.ci.prepare_env.ft_utils.get_functest_yaml',
+ return_value={'tkey1': 'tvalue1'})
+ @mock.patch('functest.ci.prepare_env.yaml.safe_load',
+ return_value={'test_scenario': {'tkey': 'tvalue'}})
+ @mock.patch('functest.ci.prepare_env.update_db_url')
+ def test_update_db_url(self, mock_db_url, mock_safe_load,
+ mock_get_functest_yaml):
+ CONST.__setattr__('DEPLOY_SCENARIO', 'default_scenario')
+ with mock.patch("__builtin__.open", mock.mock_open()), \
+ mock.patch('functest.ci.prepare_env.yaml.dump'), \
+ mock.patch.dict('functest.ci.prepare_env.os.environ',
+ {'TEST_DB_URL': self.db_url_env},
+ clear=True):
+ prepare_env.update_config_file()
+ self.assertTrue(mock_db_url.called)
+
@mock.patch('functest.ci.prepare_env.logger.info')
def test_verify_deployment_error(self, mock_logger_error):
mock_popen = mock.Mock()
@@ -418,14 +435,14 @@ class PrepareEnvTesting(unittest.TestCase):
@mock.patch('functest.ci.prepare_env.install_tempest')
@mock.patch('functest.ci.prepare_env.install_rally')
@mock.patch('functest.ci.prepare_env.verify_deployment')
- @mock.patch('functest.ci.prepare_env.patch_config_file')
+ @mock.patch('functest.ci.prepare_env.update_config_file')
@mock.patch('functest.ci.prepare_env.source_rc_file')
@mock.patch('functest.ci.prepare_env.create_directories')
@mock.patch('functest.ci.prepare_env.get_deployment_handler')
@mock.patch('functest.ci.prepare_env.check_env_variables')
@mock.patch('functest.ci.prepare_env.logger.info')
def test_main_start(self, mock_logger_info, mock_env_var, mock_dep_handler,
- mock_create_dir, mock_source_rc, mock_patch_config,
+ mock_create_dir, mock_source_rc, mock_update_config,
mock_verify_depl, mock_install_rally,
mock_install_temp, mock_create_flavor,
mock_check_env, mock_print_info):
@@ -438,7 +455,7 @@ class PrepareEnvTesting(unittest.TestCase):
self.assertTrue(mock_dep_handler.called)
self.assertTrue(mock_create_dir.called)
self.assertTrue(mock_source_rc.called)
- self.assertTrue(mock_patch_config.called)
+ self.assertTrue(mock_update_config.called)
self.assertTrue(mock_verify_depl.called)
self.assertTrue(mock_install_rally.called)
self.assertTrue(mock_install_temp.called)
diff --git a/functest/tests/unit/utils/test_decorators.py b/functest/tests/unit/utils/test_decorators.py
index 44448f238..82291fa2d 100644
--- a/functest/tests/unit/utils/test_decorators.py
+++ b/functest/tests/unit/utils/test_decorators.py
@@ -20,6 +20,7 @@ import mock
from functest.utils import decorators
from functest.utils import functest_utils
+from functest.utils.constants import CONST
__author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
@@ -65,34 +66,29 @@ class DecoratorsTesting(unittest.TestCase):
'details': {}, 'criteria': self._result}
return json.dumps(data, sort_keys=True)
- @mock.patch('{}.get_db_url'.format(functest_utils.__name__),
- return_value='http://127.0.0.1')
@mock.patch('{}.get_version'.format(functest_utils.__name__),
return_value=VERSION)
@mock.patch('requests.post')
def test_http_shema(self, *args):
+ CONST.__setattr__('results_test_db_url', 'http://127.0.0.1')
self.assertTrue(functest_utils.push_results_to_db(
self._project_name, self._case_name, self._start_time,
self._stop_time, self._result, {}))
args[1].assert_called_once_with()
- args[2].assert_called_once_with()
args[0].assert_called_once_with(
'http://127.0.0.1', data=self._get_json(),
headers={'Content-Type': 'application/json'})
- @mock.patch('{}.get_db_url'.format(functest_utils.__name__),
- return_value="/dev/null")
- def test_wrong_shema(self, mock_method=None):
+ def test_wrong_shema(self):
+ CONST.__setattr__('results_test_db_url', '/dev/null')
self.assertFalse(functest_utils.push_results_to_db(
self._project_name, self._case_name, self._start_time,
self._stop_time, self._result, {}))
- mock_method.assert_called_once_with()
@mock.patch('{}.get_version'.format(functest_utils.__name__),
return_value=VERSION)
- @mock.patch('{}.get_db_url'.format(functest_utils.__name__),
- return_value=URL)
def _test_dump(self, *args):
+ CONST.__setattr__('results_test_db_url', URL)
with mock.patch.object(decorators, 'open', mock.mock_open(),
create=True) as mock_open:
self.assertTrue(functest_utils.push_results_to_db(
@@ -104,7 +100,6 @@ class DecoratorsTesting(unittest.TestCase):
self.assertIn('POST', call_args[0])
self.assertIn(self._get_json(), call_args[0])
args[0].assert_called_once_with()
- args[1].assert_called_once_with()
@mock.patch('os.makedirs')
def test_default_dump(self, mock_method=None):
@@ -116,16 +111,14 @@ class DecoratorsTesting(unittest.TestCase):
self._test_dump()
mock_method.assert_called_once_with(DIR)
- @mock.patch('{}.get_db_url'.format(functest_utils.__name__),
- return_value=URL)
@mock.patch('os.makedirs', side_effect=OSError)
def test_makedirs_exc(self, *args):
+ CONST.__setattr__('results_test_db_url', URL)
self.assertFalse(
functest_utils.push_results_to_db(
self._project_name, self._case_name, self._start_time,
self._stop_time, self._result, {}))
args[0].assert_called_once_with(DIR)
- args[1].assert_called_once_with()
if __name__ == "__main__":
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py
index 12604c1a0..d84a32013 100644
--- a/functest/tests/unit/utils/test_functest_utils.py
+++ b/functest/tests/unit/utils/test_functest_utils.py
@@ -19,6 +19,7 @@ from six.moves import urllib
from functest.tests.unit import test_utils
from functest.utils import functest_utils
+from functest.utils.constants import CONST
class FunctestUtilsTesting(unittest.TestCase):
@@ -58,6 +59,7 @@ class FunctestUtilsTesting(unittest.TestCase):
self.config_yaml = os.path.normpath(os.path.join(os.path.dirname(
os.path.abspath(__file__)), '../../../ci/config_functest.yaml'))
self.db_url_env = 'http://foo/testdb'
+ self.testcases_yaml = "test_testcases_yaml"
self.file_yaml = {'general': {'openstack': {'image_name':
'test_image_name'}}}
@@ -208,23 +210,9 @@ class FunctestUtilsTesting(unittest.TestCase):
self.assertEqual(functest_utils.get_build_tag(),
self.build_tag)
- def test_get_db_url_env_var(self):
- with mock.patch.dict(os.environ,
- {'TEST_DB_URL': self.db_url_env,
- 'CONFIG_FUNCTEST_YAML':
- "./functest/ci/config_functest.yaml"},
- clear=True):
- self.assertEqual(functest_utils.get_db_url(),
- self.db_url_env)
-
- @mock.patch('functest.utils.functest_utils.get_functest_config')
- def test_get_db_url_default(self, mock_get_functest_config):
- mock_get_functest_config.return_value = self.db_url
- self.assertEqual(functest_utils.get_db_url(), self.db_url)
- mock_get_functest_config.assert_called_once_with('results.test_db_url')
-
@mock.patch('functest.utils.functest_utils.logger.info')
def test_logger_test_results(self, mock_logger_info):
+ CONST.__setattr__('results_test_db_url', self.db_url)
with mock.patch('functest.utils.functest_utils.get_pod_name',
return_value=self.node_name), \
mock.patch('functest.utils.functest_utils.get_scenario',
@@ -232,9 +220,7 @@ class FunctestUtilsTesting(unittest.TestCase):
mock.patch('functest.utils.functest_utils.get_version',
return_value=self.version), \
mock.patch('functest.utils.functest_utils.get_build_tag',
- return_value=self.build_tag), \
- mock.patch('functest.utils.functest_utils.get_db_url',
- return_value=self.db_url):
+ return_value=self.build_tag):
functest_utils.logger_test_results(self.project, self.case_name,
self.status, self.details)
mock_logger_info.assert_called_once_with(
@@ -251,7 +237,7 @@ class FunctestUtilsTesting(unittest.TestCase):
"details:\t%(d)s\n"
% {'p': self.project,
'n': self.case_name,
- 'db': self.db_url,
+ 'db': CONST.__getattribute__('results_test_db_url'),
'pod': self.node_name,
'v': self.version,
's': self.scenario,
@@ -269,11 +255,10 @@ class FunctestUtilsTesting(unittest.TestCase):
def _test_push_results_to_db_missing_env(self, env_var):
dic = self._get_env_dict(env_var)
- with mock.patch('functest.utils.functest_utils.get_db_url',
- return_value=self.db_url), \
- mock.patch.dict(os.environ,
- dic,
- clear=True), \
+ CONST.__setattr__('results_test_db_url', self.db_url)
+ with mock.patch.dict(os.environ,
+ dic,
+ clear=True), \
mock.patch('functest.utils.functest_utils.logger.error') \
as mock_logger_error:
functest_utils.push_results_to_db(self.project, self.case_name,
@@ -297,11 +282,10 @@ class FunctestUtilsTesting(unittest.TestCase):
def test_push_results_to_db_request_post_failed(self):
dic = self._get_env_dict(None)
- with mock.patch('functest.utils.functest_utils.get_db_url',
- return_value=self.db_url), \
- mock.patch.dict(os.environ,
- dic,
- clear=True), \
+ CONST.__setattr__('results_test_db_url', self.db_url)
+ with mock.patch.dict(os.environ,
+ dic,
+ clear=True), \
mock.patch('functest.utils.functest_utils.logger.error') \
as mock_logger_error, \
mock.patch('functest.utils.functest_utils.requests.post',
@@ -320,11 +304,10 @@ class FunctestUtilsTesting(unittest.TestCase):
def test_push_results_to_db_request_post_exception(self):
dic = self._get_env_dict(None)
- with mock.patch('functest.utils.functest_utils.get_db_url',
- return_value=self.db_url), \
- mock.patch.dict(os.environ,
- dic,
- clear=True), \
+ CONST.__setattr__('results_test_db_url', self.db_url)
+ with mock.patch.dict(os.environ,
+ dic,
+ clear=True), \
mock.patch('functest.utils.functest_utils.logger.error') \
as mock_logger_error, \
mock.patch('functest.utils.functest_utils.requests.post',
@@ -338,11 +321,10 @@ class FunctestUtilsTesting(unittest.TestCase):
def test_push_results_to_db_default(self):
dic = self._get_env_dict(None)
- with mock.patch('functest.utils.functest_utils.get_db_url',
- return_value=self.db_url), \
- mock.patch.dict(os.environ,
- dic,
- clear=True), \
+ CONST.__setattr__('results_test_db_url', self.db_url)
+ with mock.patch.dict(os.environ,
+ dic,
+ clear=True), \
mock.patch('functest.utils.functest_utils.requests.post'):
self.assertTrue(functest_utils.
push_results_to_db(self.project, self.case_name,
@@ -562,11 +544,13 @@ class FunctestUtilsTesting(unittest.TestCase):
# TODO: merge_dicts
- def test_get_testcases_file_dir(self):
+ @mock.patch('functest.utils.functest_utils.get_functest_config')
+ def test_get_testcases_file_dir(self, mock_get_functest_config):
+ mock_get_functest_config.return_value = self.testcases_yaml
resp = functest_utils.get_testcases_file_dir()
- self.assertEqual(resp,
- "/home/opnfv/repos/functest/"
- "functest/ci/testcases.yaml")
+ self.assertEqual(resp, self.testcases_yaml)
+ mock_get_functest_config.assert_called_once_with(
+ 'general.functest.testcases_yaml')
def test_get_functest_yaml(self):
with mock.patch('six.moves.builtins.open', mock.mock_open()), \
diff --git a/functest/utils/decorators.py b/functest/utils/decorators.py
index 73e0a3520..230a99e75 100644
--- a/functest/utils/decorators.py
+++ b/functest/utils/decorators.py
@@ -1,5 +1,12 @@
#!/usr/bin/env python
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
# pylint: disable=missing-docstring
import errno
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index dc20eea10..995d94ff0 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -26,6 +26,7 @@ from git import Repo
from functest.utils import constants
from functest.utils import decorators
+from functest.utils.constants import CONST
logger = logging.getLogger(__name__)
@@ -149,24 +150,15 @@ def get_build_tag():
return build_tag
-def get_db_url():
+def logger_test_results(project, case_name, status, details):
"""
- Returns DB URL
+ Format test case results for the logger
"""
- # TODO use CONST mechanism
- try:
- # if TEST_DB_URL declared in env variable, use it!
- db_url = os.environ['TEST_DB_URL']
- except KeyError:
- db_url = get_functest_config('results.test_db_url')
- return db_url
-
-
-def logger_test_results(project, case_name, status, details):
pod_name = get_pod_name()
scenario = get_scenario()
version = get_version()
build_tag = get_build_tag()
+ db_url = CONST.__getattribute__("results_test_db_url")
logger.info(
"\n"
@@ -182,7 +174,7 @@ def logger_test_results(project, case_name, status, details):
"details:\t%(d)s\n"
% {'p': project,
'n': case_name,
- 'db': get_db_url(),
+ 'db': db_url,
'pod': pod_name,
'v': version,
's': scenario,
@@ -198,7 +190,7 @@ def push_results_to_db(project, case_name,
POST results to the Result target DB
"""
# Retrieve params from CI and conf
- url = get_db_url()
+ url = CONST.__getattribute__("results_test_db_url")
try:
installer = os.environ['INSTALLER_TYPE']