Add test verification to ansible-test. (#22636)

* Add unified git diff parser.
* Add metadata and diff handling.
* Add test confidence/verification to bot output.
This commit is contained in:
Matt Clay 2017-03-15 12:17:42 -07:00 committed by GitHub
parent 5e9a2b8528
commit 869449e288
14 changed files with 623 additions and 10 deletions

View file

@ -41,6 +41,7 @@ from lib.util import (
remove_tree,
make_dirs,
is_shippable,
is_binary_file,
)
from lib.test import (
@ -82,6 +83,10 @@ from lib.test import (
TestSkipped,
)
from lib.metadata import (
Metadata,
)
SUPPORTED_PYTHON_VERSIONS = (
'2.6',
'2.7',
@ -919,7 +924,7 @@ def detect_changes(args):
def detect_changes_shippable(args):
"""Initialize change detection on Shippable.
:type args: CommonConfig
:type args: TestConfig
:rtype: list[str]
"""
git = Git(args)
@ -934,6 +939,9 @@ def detect_changes_shippable(args):
display.info('Processing %s for branch %s commit %s' % (job_type, result.branch, result.commit))
if not args.metadata.changes:
args.metadata.populate_changes(result.diff)
return result.paths
@ -977,6 +985,19 @@ def detect_changes_local(args):
if args.unstaged:
names |= set(result.unstaged)
if not args.metadata.changes:
args.metadata.populate_changes(result.diff)
for path in result.untracked:
if is_binary_file(path):
args.metadata.changes[path] = ((0, 0),)
continue
with open(path, 'r') as source_fd:
line_count = len(source_fd.read().splitlines())
args.metadata.changes[path] = ((1, line_count),)
return sorted(names)