From 36baf7d83a7256ea0334d515954ce5acdad8877e Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 7 Mar 2019 22:50:10 -0800 Subject: [PATCH] Make ansible-test less noisy for change detection. (#53497) * Make ansible-test less noisy for change detection. * Set verbosity=2 for dependent file expansion. --- test/runner/lib/classification.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test/runner/lib/classification.py b/test/runner/lib/classification.py index 11e505f72a..a379cb7adf 100644 --- a/test/runner/lib/classification.py +++ b/test/runner/lib/classification.py @@ -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')