ansible-test: add skip/windows/... alias to skip tests on specific Windows versions (#46845)

* ansible-test: add skip/windows/... alias to skip tests on specific Windows versions

* show what tests were skipped

* changes to logic to only skip if all Windows targets are set to skip

* codestyle improvements

* change warning message based on review

* check args type before running the Windows path
This commit is contained in:
Jordan Borean 2018-10-12 15:32:46 +10:00 committed by GitHub
parent ec88510fd4
commit 0f5331645f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View file

@ -1,2 +1,3 @@
shippable/windows/group3
unstable
skip/windows/2008 # httptester requires SSH which doesn't work with 2008

View file

@ -1410,6 +1410,40 @@ def common_integration_filter(args, targets, exclude):
display.warning('Excluding tests marked "%s" which require --allow-unstable or prefixing with "unstable/": %s'
% (skip.rstrip('/'), ', '.join(skipped)))
# only skip a Windows test if using --windows and all the --windows versions are defined in the aliases as skip/windows/%s
if isinstance(args, WindowsIntegrationConfig) and args.windows:
all_skipped = []
not_skipped = []
for target in targets:
if "skip/windows/" not in target.aliases:
continue
skip_valid = []
skip_missing = []
for version in args.windows:
if "skip/windows/%s/" % version in target.aliases:
skip_valid.append(version)
else:
skip_missing.append(version)
if skip_missing and skip_valid:
not_skipped.append((target.name, skip_valid, skip_missing))
elif skip_valid:
all_skipped.append(target.name)
if all_skipped:
exclude.extend(all_skipped)
skip_aliases = ["skip/windows/%s/" % w for w in args.windows]
display.warning('Excluding tests marked "%s" which are set to skip with --windows %s: %s'
% ('", "'.join(skip_aliases), ', '.join(args.windows), ', '.join(all_skipped)))
if not_skipped:
for target, skip_valid, skip_missing in not_skipped:
# warn when failing to skip due to lack of support for skipping only some versions
display.warning('Including test "%s" which was marked to skip for --windows %s but not %s.'
% (target, ', '.join(skip_valid), ', '.join(skip_missing)))
def get_integration_local_filter(args, targets):
"""