diff options
author | Tomofumi Hayashi <tohayash@redhat.com> | 2016-11-10 14:49:46 +0900 |
---|---|---|
committer | Tomofumi Hayashi <tohayash@redhat.com> | 2016-11-10 17:40:08 +0900 |
commit | 4c15ea3f8e5c8f3ded834113d21a3adeb75add35 (patch) | |
tree | 0ff847a07cfd450e64716281f58d08b98ccd9a66 | |
parent | cd7b2cdaef7226165e511337858f10279652104d (diff) |
Add "docker tag" option for each testcase containers.
JIRA: DOVETAIL-69
This commit is to add new option to specify docker tags for
each test containers, such as '--TAG "functest:stable"'.
Change-Id: Ica11e16abfb21649a3eea9c7d7d5cd31502d2e21
Signed-off-by: Tomofumi Hayashi <tohayash@redhat.com>
-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 63d51ed0..40994566 100644 --- a/dovetail/conf/cmd_config.yml +++ b/dovetail/conf/cmd_config.yml @@ -43,3 +43,8 @@ cli: - '-s' default: 'basic' 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 310ef2aa..1306a5ab 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) |