diff --git a/openstack/tools/charmed_openstack_functest_runner.sh b/openstack/tools/charmed_openstack_functest_runner.sh index f34bac55..79f17d84 100755 --- a/openstack/tools/charmed_openstack_functest_runner.sh +++ b/openstack/tools/charmed_openstack_functest_runner.sh @@ -248,6 +248,8 @@ for target in ${!func_targets[@]}; do fi [[ -d src ]] && pushd src &>/dev/null || true fail=false + # Remove substitutions and replace with whitespace + target=${target//+/ } if ! $MANUAL_FUNCTESTS; then tox ${tox_args} -- $target || fail=true model=`juju list-models| egrep -o "^zaza-\S+"|tr -d '*'` diff --git a/openstack/tools/func_test_tools/common.py b/openstack/tools/func_test_tools/common.py index 72c8903c..ccae300a 100644 --- a/openstack/tools/func_test_tools/common.py +++ b/openstack/tools/func_test_tools/common.py @@ -23,7 +23,12 @@ def project_check_jobs(self): if 'check' not in item['project']: continue - yield from item['project']['check'].get('jobs', []) + for job in item['project']['check'].get('jobs', []): + # can be a dict with voting info + if isinstance(job, dict): + yield list(job.keys())[0] + else: + yield job @property def jobs(self): diff --git a/openstack/tools/func_test_tools/identify_charm_func_tests.py b/openstack/tools/func_test_tools/identify_charm_func_tests.py index 95bd6d96..bd7da1c6 100644 --- a/openstack/tools/func_test_tools/identify_charm_func_tests.py +++ b/openstack/tools/func_test_tools/identify_charm_func_tests.py @@ -22,14 +22,22 @@ def extract_targets(bundle_list): extracted = [] for item in bundle_list or []: if isinstance(item, dict): - extracted.append(list(item.values())[0]) + values = list(item.values()) + for value in values: + if isinstance(value, list): + # its a list of overlays so we get the key name and go find + # the corresponding job in osci.yaml + extracted.append(list(item.keys())[0]) + else: + # its a bundle name + extracted.append(value) else: extracted.append(item) return extracted -def get_aliased_targets(): +def get_aliased_targets(bundles): """ Extract aliased targets. A charm can define aliased targets which is where Zaza tests are run and use configuration steps from an alias section rather @@ -38,10 +46,13 @@ def get_aliased_targets(): job definition in osci.yaml where the target name has a : prefix. We extract any aliased targets here and return as a list. + + @param bundles: list of extracted bundles """ targets = [] osci = OSCIConfig() - for jobname in osci.project_check_jobs: + jobs = list(osci.project_check_jobs) + bundles + for jobname in jobs: for job in osci.jobs: if job['name'] != jobname: continue @@ -49,12 +60,17 @@ def get_aliased_targets(): if 'tox_extra_args' not in job['vars']: continue - ret = re.search(r"-- (\S+:\S+)", + ret = re.search(r"-- (.+)", str(job['vars']['tox_extra_args'])) if ret: - targets.append(ret.group(1)) + target = ret.group(1) + # NOTE: will need to reverse this when we use the target name + target = target.replace(' ', '+') + targets.append(target) + if jobname in bundles: + bundles.remove(jobname) - return targets + return targets + bundles def get_tests_bundles(): @@ -76,6 +92,6 @@ def get_tests_bundles(): if __name__ == "__main__": - aliased_bundles = get_aliased_targets() - tests_bundles = get_tests_bundles() - print(' '.join(sorted(set(tests_bundles + aliased_bundles)))) + _bundles = get_tests_bundles() + _bundles = get_aliased_targets(_bundles) + print(' '.join(sorted(set(_bundles))))