Consolidate approved policies and add local lease, document CAS, commit, candidate and environment gates. Preserve conservative recovery and cleanup limits.
30 lines
997 B
Python
30 lines
997 B
Python
#!/usr/bin/env python3
|
|
"""Validate exact expected top-level go test -v results from one final attempt."""
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
import re
|
|
|
|
|
|
def verify(text, expected):
|
|
observed = {name: [] for name in expected}
|
|
for status, name in re.findall(r'^--- (PASS|FAIL|SKIP): (Test[A-Za-z0-9_]+) \(', text, re.M):
|
|
if name in observed:
|
|
observed[name].append(status)
|
|
return {'passed': bool(expected) and all(states == ['PASS'] for states in observed.values()),
|
|
'expected': expected, 'observed': observed}
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--log', required=True)
|
|
parser.add_argument('--expected', action='append', required=True)
|
|
args = parser.parse_args()
|
|
result = verify(Path(args.log).read_text(), args.expected)
|
|
print(json.dumps(result, sort_keys=True))
|
|
return 0 if result['passed'] else 1
|
|
|
|
|
|
if __name__ == '__main__':
|
|
raise SystemExit(main())
|