summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/conf/dovetail_config.py4
-rw-r--r--scripts/conf/yardstick_config.yml5
-rw-r--r--scripts/container.py13
-rwxr-xr-xscripts/run.py25
4 files changed, 22 insertions, 25 deletions
diff --git a/scripts/conf/dovetail_config.py b/scripts/conf/dovetail_config.py
index 8d60cd97..92d1f479 100644
--- a/scripts/conf/dovetail_config.py
+++ b/scripts/conf/dovetail_config.py
@@ -26,7 +26,3 @@ container_config = {}
container_config['functest'] = dovetail_config['functest']
container_config['yardstick'] = dovetail_config['yardstick']
-
-container_config['functest']['has_pull'] = False
-container_config['yardstick']['has_pull'] = False
-container_config['yardstick']['has_build_images'] = False
diff --git a/scripts/conf/yardstick_config.yml b/scripts/conf/yardstick_config.yml
index 5c04a286..9eda6e54 100644
--- a/scripts/conf/yardstick_config.yml
+++ b/scripts/conf/yardstick_config.yml
@@ -9,9 +9,12 @@ yardstick:
result_dir: '/tmp/yardstick/result'
shell_dir: '/tmp/yardstick'
shell_dir_name: 'prepare_test_yard'
+ testcase:
+ build_test_cmd: '/tmp/yardstick/build_run_test.sh %s.yaml /tmp/yardstick/result/%s.out'
+ test_cmd: '/tmp/yardstick/run_test.sh %s.yaml /tmp/yardstick/result/%s.out'
result:
dir: '/tmp/yardstick/result'
store_type: 'file'
db_url: 'http://testresults.opnfv.org/test/api/v1/results?case=%s&last=1'
- file_path: '/tmp/yardstick/result/yardstick.log'
+ file_path: '/home/opnfv/dovetail/results/yardstick.log'
diff --git a/scripts/container.py b/scripts/container.py
index 4bbc5e5b..678a0929 100644
--- a/scripts/container.py
+++ b/scripts/container.py
@@ -16,6 +16,8 @@ logger = dt_logger.Logger('container.py').getLogger()
class Container:
container_list = {}
+ has_pull_latest_image = {'yardstick':False, 'functest':False}
+ has_build_images = {'yardstick':False, 'functest':False}
def __init__(cls):
pass
@@ -48,12 +50,12 @@ class Container:
@classmethod
def pull_image(cls, type):
docker_image = cls.get_docker_image(type)
- if container_config[type]['has_pull'] == True:
+ if cls.has_pull_latest_image[type] == True:
logger.debug('%s is already the newest version.' % (docker_image))
else:
cmd = 'sudo docker pull %s' % (docker_image)
dt_utils.exec_cmd(cmd,logger)
- container_config[type]['has_pull'] = True
+ cls.has_pull_latest_image[type] = True
@classmethod
def clean(cls, container_id):
@@ -67,4 +69,9 @@ class Container:
cmd = 'sudo docker exec %s %s' % (container_id, sub_cmd)
dt_utils.exec_cmd(cmd,logger,exit_on_error)
-
+ @classmethod
+ def copy_file(cls, file_dir, container_id, container_dir):
+ for root, dirs, files in os.walk(file_dir):
+ for file_name in files:
+ cmd = 'sudo docker cp %s %s:%s' % (os.path.join(file_dir,file_name), container_id, container_dir)
+ dt_utils.exec_cmd(cmd, logger, exit_on_error = False)
diff --git a/scripts/run.py b/scripts/run.py
index a8ef819c..9b59f76f 100755
--- a/scripts/run.py
+++ b/scripts/run.py
@@ -29,12 +29,6 @@ def load_scenario(scenario):
def load_testcase():
Testcase.load()
-def copy_file(file_dir, container_id, container_dir):
- for root, dirs, files in os.walk(file_dir):
- for file_name in files:
- cmd = 'sudo docker cp %s %s:%s' % (os.path.join(file_dir,file_name), container_id, container_dir)
- dt_utils.exec_cmd(cmd, logger, exit_on_error = False)
-
def run_functest(testcase, container_id):
sub_cmd = dovetail_config[testcase.script_type()]['testcase']['pre_cmd']
Container.exec_cmd(container_id, sub_cmd)
@@ -42,18 +36,15 @@ def run_functest(testcase, container_id):
Container.exec_cmd(container_id, sub_cmd)
def run_yardstick(testcase, container_id):
- copy_file(os.path.join(os.getcwd(),container_config[testcase.script_type()]['shell_dir_name']),\
- container_id,container_config[testcase.script_type()]['shell_dir'])
- if container_config[testcase.script_type()]['has_build_images'] == True:
- cmd = 'sudo docker exec %s %s/run_test.sh %s.yaml %s/%s.out' \
- % (container_id, container_config[testcase.script_type()]['shell_dir'], testcase.script_testcase(),\
- container_config[testcase.script_type()]['result_dir'], testcase.name())
+ type = testcase.script_type()
+ Container.copy_file(os.path.join(os.getcwd(), dovetail_config[type]['shell_dir_name']),\
+ container_id, dovetail_config[type]['shell_dir'])
+ if Container.has_build_images[type] == True:
+ sub_cmd = dovetail_config[type]['testcase']['test_cmd'] % (testcase.script_testcase(), testcase.name())
else:
- container_config[testcase.script_type()]['has_build_images'] = True
- cmd = 'sudo docker exec %s %s/build_run_test.sh %s.yaml %s/%s.out' \
- % (container_id, container_config[testcase.script_type()]['shell_dir'], testcase.script_testcase(),\
- container_config[testcase.script_type()]['result_dir'], testcase.name())
- dt_utils.exec_cmd(cmd,logger,exit_on_error = False)
+ Container.has_build_images[type] = True
+ sub_cmd = dovetail_config[type]['testcase']['build_test_cmd'] % (testcase.script_testcase(), testcase.name())
+ Container.exec_cmd(container_id, sub_cmd)
time.sleep(5)
def run_test(scenario):