diff options
author | hongbo tian <hongbo.tianhongbo@huawei.com> | 2016-11-15 08:43:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-11-15 08:43:55 +0000 |
commit | 3f1313cf34a5999b914739a1c03f0043500303a2 (patch) | |
tree | cf9dcfb088c9231918814b05eaba793a409a2c66 | |
parent | 0eb2bd6622deb721f9df937ef463f7d9ec221235 (diff) | |
parent | 4c15ea3f8e5c8f3ded834113d21a3adeb75add35 (diff) |
Merge "Add "docker tag" option for each testcase containers."
-rw-r--r-- | dovetail/conf/cmd_config.yml | 5 | ||||
-rwxr-xr-x | dovetail/run.py | 22 |
2 files changed, 27 insertions, 0 deletions
diff --git a/dovetail/conf/cmd_config.yml b/dovetail/conf/cmd_config.yml index 444303dc..c2108c58 100644 --- a/dovetail/conf/cmd_config.yml +++ b/dovetail/conf/cmd_config.yml @@ -43,3 +43,8 @@ cli: - '-s' default: 'compliance_set' help: 'certification scenario.' + tag: + flags: + - '--tag' + - '-o' + help: 'Overwrite tags for each docker container (e.g. "functest:stable,yardstick:latest")' diff --git a/dovetail/run.py b/dovetail/run.py index 25f9fe5b..b4b9dda4 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -9,6 +9,7 @@ import click +import sys import utils.dovetail_logger as dt_logger @@ -29,6 +30,14 @@ def load_scenario(scenario): return Scenario.get(SCENARIO_NAMING_FMT % scenario) +def set_container_tags(option_str): + for script_tag_opt in option_str.split(','): + option_str = script_tag_opt.split(':') + script_type = option_str[0].strip() + script_tag = option_str[1].strip() + dovetail_config[script_type]['docker_tag'] = script_tag + + def load_testcase(): Testcase.load() @@ -75,6 +84,16 @@ def run_test(scenario): Report.check_result(testcase, db_result) +def validate_options(input_dict): + # for 'tag' option + for key, value in input_dict.items(): + if key == 'tag': + for tag in value.split(','): + if len(tag.split(':')) != 2: + logger.error('TAGS option must be "<image>:<tag>,..."') + sys.exit(1) + + def filter_env_options(input_dict): envs_options = {} for key, value in input_dict.items(): @@ -89,6 +108,7 @@ def main(*args, **kwargs): logger.info('=======================================') logger.info('Dovetail certification: %s!' % (kwargs['scenario'])) logger.info('=======================================') + validate_options(kwargs) envs_options = filter_env_options(kwargs) update_envs(envs_options) logger.info('Your new envs for functest: %s' % @@ -97,6 +117,8 @@ def main(*args, **kwargs): dovetail_config['yardstick']['envs']) load_testcase() scenario_yaml = load_scenario(kwargs['scenario']) + if 'tag' in kwargs: + set_container_tags(kwargs['tag']) run_test(scenario_yaml) Report.generate(scenario_yaml) |