Make ansible-test less noisy for change detection. (#53497)

* Make ansible-test less noisy for change detection.
* Set verbosity=2 for dependent file expansion.
This commit is contained in:
Matt Clay 2019-03-07 22:50:10 -08:00 committed by GitHub
parent f08a26d77b
commit 36baf7d83a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,10 +81,10 @@ def categorize_changes(args, paths, verbose_command=None):
if not dependent_paths:
continue
display.info('Expanded "%s" to %d dependent file(s):' % (path, len(dependent_paths)), verbosity=1)
display.info('Expanded "%s" to %d dependent file(s):' % (path, len(dependent_paths)), verbosity=2)
for dependent_path in dependent_paths:
display.info(dependent_path, verbosity=1)
display.info(dependent_path, verbosity=2)
additional_paths.add(dependent_path)
additional_paths -= set(paths) # don't count changed paths as additional paths
@ -95,6 +95,8 @@ def categorize_changes(args, paths, verbose_command=None):
display.info('Mapping %d changed file(s) to tests.' % len(paths))
none_count = 0
for path in paths:
tests = mapper.classify(path)
@ -125,7 +127,15 @@ def categorize_changes(args, paths, verbose_command=None):
else:
result = '%s' % tests
display.info('%s -> %s' % (path, result), verbosity=1)
if not tests.get(verbose_command):
# minimize excessive output from potentially thousands of files which do not trigger tests
none_count += 1
verbosity = 2
else:
verbosity = 1
if args.verbosity >= verbosity:
display.info('%s -> %s' % (path, result), verbosity=1)
for command, target in tests.items():
commands[command].add(target)
@ -133,6 +143,9 @@ def categorize_changes(args, paths, verbose_command=None):
if focused_target:
focused_commands[command].add(target)
if none_count > 0 and args.verbosity < 2:
display.notice('Omitted %d file(s) that triggered no tests.' % none_count)
for command in commands:
commands[command].discard('none')