36 lines
1.6 KiB
Python
36 lines
1.6 KiB
Python
"""Build the I6 http golden fixture: examples/ingest-golden-http/{fixture/status, fixture/report,
|
|
ingested-at.txt}.
|
|
|
|
Regenerable throwaway (mirrors the I4 sql builder). The http golden does NOT commit a live
|
|
response — the fixture files ARE the canned payloads a mock ``get`` returns (no socket, no
|
|
credentials: ``credential_ref`` is null). Payloads are authored as RAW bytes so the verbatim
|
|
backslashes in ``c:\\temp\\cache`` and ``backslash \\`` survive exactly: a normal Python string
|
|
literal would turn ``\\t`` into a TAB and ``\\c`` into a literal backslash-c, silently corrupting
|
|
the fenced-not-escaped discriminator the golden test depends on. LF-only, so the golden is
|
|
platform-stable.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
GOLDEN = Path(__file__).resolve().parents[3] / "examples" / "ingest-golden-http"
|
|
|
|
|
|
def main() -> None:
|
|
fixture = GOLDEN / "fixture"
|
|
fixture.mkdir(parents=True, exist_ok=True)
|
|
# 1 line; a raw | and \ discriminate fenced-verbatim rendering from table-escaping.
|
|
status = rb'{"service": "billing", "state": "degraded | partial", "path": "c:\temp\cache"}'
|
|
(fixture / "status").write_bytes(status + b"\n")
|
|
# 3 lines (<= max_rows); pipe + backslash kept verbatim inside the fence.
|
|
report = (
|
|
b"baseline ok\n" + rb"pipe | and backslash \ kept verbatim" + b"\n" + b"end of report\n"
|
|
)
|
|
(fixture / "report").write_bytes(report)
|
|
(GOLDEN / "ingested-at.txt").write_bytes(b"2026-07-04T12:00:00Z\n")
|
|
print(f"built {fixture}/status, {fixture}/report + ingested-at.txt")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|