test(fifa17): harden SBC retail acceptance
This commit is contained in:
@@ -278,7 +278,7 @@ def cmd_parse(args):
|
||||
os.makedirs(out_dir, exist_ok=True)
|
||||
out_path = os.path.join(out_dir, "transactions.jsonl")
|
||||
|
||||
total, skipped = 0, 0
|
||||
total, skipped, filtered = 0, 0, 0
|
||||
with open(out_path, "w") as out:
|
||||
for conn_id in sorted(conns):
|
||||
c = conns[conn_id]
|
||||
@@ -298,6 +298,9 @@ def cmd_parse(args):
|
||||
m = re.match(r"(\S+)\s+(\S+)\s+(HTTP/\d\.\d)", rl)
|
||||
method, target, ver = (m.group(1), m.group(2), m.group(3)) if m else ("?", rl, "?")
|
||||
path, _, query = target.partition("?")
|
||||
if args.path_prefix and not path.startswith(args.path_prefix):
|
||||
filtered += 1
|
||||
continue
|
||||
st = re.match(r"HTTP/\d\.\d\s+(\d+)", sl)
|
||||
req_t, req_unix = time_at(c["marks"]["c2s"], rend - 1)
|
||||
res_t, res_unix = time_at(c["marks"]["s2c"], max(send - 1, 0))
|
||||
@@ -342,9 +345,14 @@ def cmd_parse(args):
|
||||
total += 1
|
||||
|
||||
os.chmod(out_path, 0o644)
|
||||
detail = []
|
||||
if skipped:
|
||||
detail.append("%d unpaired messages reported above" % skipped)
|
||||
if filtered:
|
||||
detail.append("%d transactions excluded by path prefix" % filtered)
|
||||
print("wrote %s (%d transactions across %d connections%s)"
|
||||
% (out_path, total, len(conns),
|
||||
"; %d unpaired messages reported above" % skipped if skipped else ""))
|
||||
"; " + "; ".join(detail) if detail else ""))
|
||||
return 0
|
||||
|
||||
|
||||
@@ -587,6 +595,8 @@ def main():
|
||||
# fixture for the whole response.
|
||||
p.add_argument("--max-body", type=int, default=0,
|
||||
help="bytes; 0 = keep every body in full")
|
||||
p.add_argument("--path-prefix", default="",
|
||||
help="emit only transactions whose request path starts with this prefix")
|
||||
p.set_defaults(fn=cmd_parse)
|
||||
|
||||
s = sub.add_parser("snapshot")
|
||||
|
||||
Reference in New Issue
Block a user