aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils/functest_utils.py
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2017-03-14 16:57:05 +0100
committerMorgan Richomme <morgan.richomme@orange.com>2017-03-15 09:23:00 +0100
commit0c194ede4dd9eb46b61af49e85527fcc368a8fca (patch)
tree325c5d854b5ab1c6e269f43ab363fe5b78dd1dde /functest/utils/functest_utils.py
parent11d59071a11fcec1ef9fcd323070c6d4f151c7cd (diff)
env variable support for test DB url
So far DB url was retrieved from configuration file If you want to use the CI chain (jenkins, testapi, test DB, functest, ..) then you have a problem calling functest will systematically point to the configuration from the repo Supporting env variable allow to avoid post processing in the configuration file and as a consequence offer the possibility to create a local DB to host local results Change-Id: Ie64b8b265827d7f5724c7066a8c173de8cf012e2 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'functest/utils/functest_utils.py')
-rw-r--r--functest/utils/functest_utils.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index dbed811a..e5e755d7 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -151,7 +151,15 @@ def get_db_url():
"""
Returns DB URL
"""
- return get_functest_config('results.test_db_url')
+ # TODO use CONST mechanism
+ try:
+ # if TEST_DB_URL declared in env variable, use it!
+ db_url = os.environ['TEST_DB_URL']
+ except KeyError:
+ logger.info("DB URL not declared as env variable,"
+ "use local configuration")
+ db_url = get_functest_config('results.test_db_url')
+ return db_url
def logger_test_results(project, case_name, status, details):