33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Bounded single-repository protocol smoke; RP cryptographic acceptance is separate."""
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
|
|
from capture import Collector, select_epoch
|
|
from common import Archive, atomic_json, now_ms
|
|
from verify import verify
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--notification", required=True)
|
|
parser.add_argument("--archive", type=Path, required=True)
|
|
args = parser.parse_args()
|
|
if args.archive.exists():
|
|
raise ValueError("smoke archive must be new")
|
|
archive = Archive(args.archive, {"min_free_bytes": 150 * 1024**3, "min_root_free_inodes": 10000,
|
|
"attempts": 1, "request_timeout_secs": 20, "observation_deadline_secs": 180})
|
|
observation = Collector(archive).observe(args.notification)
|
|
epoch = select_epoch(args.archive, {args.notification: {"first_seen_ms": 0}}, now_ms())
|
|
atomic_json(args.archive / "epochs/epoch_0000.json", epoch)
|
|
result = verify(args.archive)
|
|
atomic_json(args.archive / "smoke.json", {"observation": observation, "closure": result,
|
|
"real_rp_crypto_acceptance": "not_run_by_this_protocol_smoke"})
|
|
print(json.dumps(result), flush=True)
|
|
return 0 if result["pass"] else 2
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|