summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--dovetail/compliance/debug.yml2
-rw-r--r--dovetail/conf/cmd_config.yml6
-rw-r--r--dovetail/conf/dovetail_config.yml8
-rw-r--r--dovetail/conf/functest_config.yml1
-rw-r--r--dovetail/conf/yardstick_config.yml1
-rw-r--r--dovetail/container.py8
-rw-r--r--dovetail/parser.py2
-rw-r--r--dovetail/report.py4
-rwxr-xr-xdovetail/run.py6
-rw-r--r--dovetail/testcase.py14
-rw-r--r--dovetail/tests/unit/test_parser.py2
-rw-r--r--dovetail/utils/dovetail_config.py (renamed from dovetail/conf/dovetail_config.py)7
-rw-r--r--dovetail/utils/dovetail_logger.py2
-rw-r--r--setup.cfg2
15 files changed, 46 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index cae3e659..c0bae6e3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
*.py[cod]
# Packages
-*.egg
+*.egg*
.testrepository
dist
build
@@ -22,6 +22,7 @@ pip-log.txt
# unittest/coverage reports
.coverage
.tox
+.cache
nosetests.xml
unittest_results.log
diff --git a/dovetail/compliance/debug.yml b/dovetail/compliance/debug.yml
index 8cc4b36c..13ba335c 100644
--- a/dovetail/compliance/debug.yml
+++ b/dovetail/compliance/debug.yml
@@ -4,7 +4,7 @@
debug:
name: debug
testcases_list:
- - dovetail.example.tc002
+ - dovetail.example.tc002
- dovetail.ipv6.tc001
- dovetail.nfvi.tc001
- dovetail.nfvi.tc002
diff --git a/dovetail/conf/cmd_config.yml b/dovetail/conf/cmd_config.yml
index e2159ca7..1c6418cb 100644
--- a/dovetail/conf/cmd_config.yml
+++ b/dovetail/conf/cmd_config.yml
@@ -52,6 +52,12 @@ cli:
path:
- 'functest/docker_tag'
help: 'Overwrite tag for functest docker container (e.g. stable or latest)'
+ creds:
+ flags:
+ - '--creds'
+ path:
+ - 'creds'
+ help: 'Openstack Credential file location'
control:
testsuite:
flags:
diff --git a/dovetail/conf/dovetail_config.yml b/dovetail/conf/dovetail_config.yml
index c01394ed..c8f9fbe4 100644
--- a/dovetail/conf/dovetail_config.yml
+++ b/dovetail/conf/dovetail_config.yml
@@ -3,10 +3,14 @@ work_dir: /home/opnfv/dovetail
result_dir: /home/opnfv/dovetail/results
report_file: 'dovetail_report.txt'
cli_file_name: 'cmd_config.yml'
+
+# OPENSTACK Credential file
+creds: '/home/opnfv/dovetail/openstack.creds'
+
# TO DO: once version scheme settled, adjust accordingly
repo: 'https://github.com/opnfv/dovetail/tree/master/'
-COMPLIANCE_PATH: ./compliance/
-TESTCASE_PATH: ./testcase/
+COMPLIANCE_PATH: compliance/
+TESTCASE_PATH: testcase/
# testsuite supported, should adjust accordingly
testsuite_supported:
- compliance_set
diff --git a/dovetail/conf/functest_config.yml b/dovetail/conf/functest_config.yml
index 682d19bf..ceb894b3 100644
--- a/dovetail/conf/functest_config.yml
+++ b/dovetail/conf/functest_config.yml
@@ -17,3 +17,4 @@ functest:
store_type: 'file'
file_path: 'tempest/tempest.log'
db_url: 'http://testresults.opnfv.org/test/api/v1/results?case=%s&last=1'
+ creds: '/home/opnfv/functest/conf/openstack.creds'
diff --git a/dovetail/conf/yardstick_config.yml b/dovetail/conf/yardstick_config.yml
index d13cf2c6..d971c104 100644
--- a/dovetail/conf/yardstick_config.yml
+++ b/dovetail/conf/yardstick_config.yml
@@ -24,3 +24,4 @@ yardstick:
store_type: 'file'
file_path: 'yardstick.log'
db_url: 'http://testresults.opnfv.org/test/api/v1/results?case=%s&last=1'
+ creds: '/home/opnfv/yardstick/openstack.creds'
diff --git a/dovetail/container.py b/dovetail/container.py
index 15e78818..59fc0d8a 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -10,7 +10,7 @@
import utils.dovetail_logger as dt_logger
import utils.dovetail_utils as dt_utils
-from conf.dovetail_config import DovetailConfig as dt_cfg
+from utils.dovetail_config import DovetailConfig as dt_cfg
class Container:
@@ -46,10 +46,12 @@ class Container:
docker_image = cls.get_docker_image(type)
envs = dovetail_config[type]['envs']
opts = dovetail_config[type]['opts']
+ creds = ' -v %s:%s ' % (dovetail_config['creds'],
+ dovetail_config[type]['creds'])
result_volume = ' -v %s:%s ' % (dovetail_config['result_dir'],
dovetail_config[type]['result']['dir'])
- cmd = 'sudo docker run %s %s %s %s %s /bin/bash' % \
- (opts, envs, sshkey, result_volume, docker_image)
+ cmd = 'sudo docker run %s %s %s %s %s %s /bin/bash' % \
+ (opts, envs, sshkey, creds, result_volume, docker_image)
dt_utils.exec_cmd(cmd, cls.logger)
ret, container_id = \
dt_utils.exec_cmd("sudo docker ps | grep " + docker_image +
diff --git a/dovetail/parser.py b/dovetail/parser.py
index ad969bc2..b00b0f89 100644
--- a/dovetail/parser.py
+++ b/dovetail/parser.py
@@ -12,7 +12,7 @@ import jinja2
import utils.dovetail_logger as dt_logger
import utils.dovetail_utils as dt_utils
-from conf.dovetail_config import DovetailConfig as dt_cfg
+from utils.dovetail_config import DovetailConfig as dt_cfg
class Parser:
diff --git a/dovetail/report.py b/dovetail/report.py
index 1f970b29..654e6bf8 100644
--- a/dovetail/report.py
+++ b/dovetail/report.py
@@ -17,7 +17,7 @@ import uuid
import utils.dovetail_logger as dt_logger
-from conf.dovetail_config import DovetailConfig as dt_cfg
+from utils.dovetail_config import DovetailConfig as dt_cfg
from testcase import Testcase
@@ -98,7 +98,7 @@ class Report:
report_txt += 'Validation ID: %s\n' % report_data['validation_ID']
report_txt += 'Upload Date: %s\n' % report_data['upload_date']
if report_data['duration'] == 0:
- report_txt += 'Duration: %s\n\n' % 'NA'
+ report_txt += 'Duration: %s\n\n' % 'N/A'
else:
report_txt += 'Duration: %.2f s\n\n' % report_data['duration']
diff --git a/dovetail/run.py b/dovetail/run.py
index c0cc872c..8a91e4b3 100755
--- a/dovetail/run.py
+++ b/dovetail/run.py
@@ -11,6 +11,7 @@
import click
import os
import copy
+import time
import utils.dovetail_logger as dt_logger
import utils.dovetail_utils as dt_utils
@@ -22,7 +23,7 @@ from testcase import Testsuite
from report import Report
from report import FunctestCrawler, YardstickCrawler
from report import FunctestChecker, YardstickChecker
-from conf.dovetail_config import DovetailConfig as dt_cfg
+from utils.dovetail_config import DovetailConfig as dt_cfg
from test_runner import DockerRunner, ShellRunner
@@ -58,7 +59,10 @@ def run_test(testsuite, testarea, logger):
run_testcase = False
if run_testcase:
+ start_time = time.time()
testcase.run()
+ end_time = time.time()
+ duration = end_time - start_time
db_result = Report.get_result(testcase)
Report.check_result(testcase, db_result)
diff --git a/dovetail/testcase.py b/dovetail/testcase.py
index 6f2d76de..dd0fd2b5 100644
--- a/dovetail/testcase.py
+++ b/dovetail/testcase.py
@@ -13,7 +13,7 @@ import yaml
import utils.dovetail_logger as dt_logger
from parser import Parser
-from conf.dovetail_config import DovetailConfig as dt_cfg
+from utils.dovetail_config import DovetailConfig as dt_cfg
from test_runner import TestRunnerFactory
@@ -158,8 +158,10 @@ class Testcase(object):
@classmethod
def load(cls):
- for root, dirs, files in \
- os.walk(dt_cfg.dovetail_config['TESTCASE_PATH']):
+ testcase_dir = os.path.dirname(os.path.abspath(__file__))
+ testcase_path = dt_cfg.dovetail_config['TESTCASE_PATH']
+ abs_testcase_path = os.path.join(testcase_dir, testcase_path)
+ for root, dirs, files in os.walk(abs_testcase_path):
for testcase_file in files:
with open(os.path.join(root, testcase_file)) as f:
testcase_yaml = yaml.safe_load(f)
@@ -254,8 +256,10 @@ class Testsuite:
@classmethod
def load(cls):
- for root, dirs, files in \
- os.walk(dt_cfg.dovetail_config['COMPLIANCE_PATH']):
+ compliance_dir = os.path.dirname(os.path.abspath(__file__))
+ compliance_path = dt_cfg.dovetail_config['COMPLIANCE_PATH']
+ abs_compliance_path = os.path.join(compliance_dir, compliance_path)
+ for root, dirs, files in os.walk(abs_compliance_path):
for testsuite_yaml in files:
with open(os.path.join(root, testsuite_yaml)) as f:
testsuite_yaml = yaml.safe_load(f)
diff --git a/dovetail/tests/unit/test_parser.py b/dovetail/tests/unit/test_parser.py
index 410a6629..73ed2b72 100644
--- a/dovetail/tests/unit/test_parser.py
+++ b/dovetail/tests/unit/test_parser.py
@@ -25,7 +25,7 @@ class TestParser(unittest.TestCase):
def setUp(self):
"""Test case setup"""
- from conf.dovetail_config import DovetailConfig as dt_cfg
+ from utils.dovetail_config import DovetailConfig as dt_cfg
dt_cfg.load_config_files()
dovetail_parser.Parser.create_log()
logging.disable(logging.CRITICAL)
diff --git a/dovetail/conf/dovetail_config.py b/dovetail/utils/dovetail_config.py
index 1087bdc5..33cf57be 100644
--- a/dovetail/conf/dovetail_config.py
+++ b/dovetail/utils/dovetail_config.py
@@ -25,15 +25,16 @@ class DovetailConfig:
@classmethod
def load_config_files(cls):
curr_path = os.path.dirname(os.path.abspath(__file__))
- with open(os.path.join(curr_path, 'dovetail_config.yml')) as f:
+ config_path = os.path.join(os.path.dirname(curr_path), 'conf')
+ with open(os.path.join(config_path, 'dovetail_config.yml')) as f:
cls.dovetail_config = yaml.safe_load(f)
for extra_config_file in cls.dovetail_config['include_config']:
- with open(os.path.join(curr_path, extra_config_file)) as f:
+ with open(os.path.join(config_path, extra_config_file)) as f:
extra_config = yaml.safe_load(f)
cls.dovetail_config.update(extra_config)
- path = os.path.join(curr_path, cls.dovetail_config['cli_file_name'])
+ path = os.path.join(config_path, cls.dovetail_config['cli_file_name'])
with open(path) as f:
cmd_yml = yaml.safe_load(f)
cls.dovetail_config['cli'] = cmd_yml[cmd_yml.keys()[0]]
diff --git a/dovetail/utils/dovetail_logger.py b/dovetail/utils/dovetail_logger.py
index bb09a7b1..685db8f7 100644
--- a/dovetail/utils/dovetail_logger.py
+++ b/dovetail/utils/dovetail_logger.py
@@ -24,7 +24,7 @@
import logging
import os
-from conf.dovetail_config import DovetailConfig as dt_cfg
+from dovetail_config import DovetailConfig as dt_cfg
class Logger:
diff --git a/setup.cfg b/setup.cfg
index c691f066..46f2c4d4 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,4 +4,4 @@ home-page = https://wiki.opnfv.org/display/dovetail
[entry_points]
console_scripts =
- dovetail = dovetail.main:main
+ dovetail = dovetail.run:main