File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed
infrastructure/raw-writer-2 Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 1111@ts6 = 2026-04-02T10:05:00Z
1212@ts7 = 2026-04-02T10:06:00Z
1313@ts8 = 2026-04-02T10:07:00Z
14+ @ts9 = 2026-04-02T10:08:00Z
1415
1516
1617# ─── Health checks ────────────────────────────────────────────────────────────
@@ -66,9 +67,18 @@ User-Agent: calls-http/test
6667
6768###
6869
69- ### Small BSON (invalid) — malformed JSON with application/bson content-type (→ Mongo, binary field; bytes stored as-is)
70- # The service stores whatever bytes it receives; BSON/JSON validation is the consumer's job.
71- POST {{host }}/raw-writer-test/small-bson-invalid/{{ts5}}
70+ ### Small BSON (binary) — actual binary BSON bytes with application/bson content-type (→ Mongo, parsed as bson.M)
71+ # testdata/small.bson is generated by ./testdata/generate.sh
72+ POST {{host }}/raw-writer-test/small-bson-binary/{{ts5}}
73+ Content-Type: application/bson
74+ User-Agent: calls-http/test
75+
76+ < ./testdata/small.bson
77+
78+ ###
79+
80+ ### Small BSON (invalid) — malformed bytes, neither JSON nor BSON (→ Mongo, stored as raw binary)
81+ POST {{host }}/raw-writer-test/small-bson-invalid/{{ts9}}
7282Content-Type: application/bson
7383User-Agent: calls-http/test
7484
Original file line number Diff line number Diff line change 11small.bin
2+ small.bson
23large.json
34large.bin
Original file line number Diff line number Diff line change @@ -13,6 +13,25 @@ cd "$(dirname "$0")"
1313printf ' \xDE\xAD\xBE\xEF' > small.bin
1414echo " created small.bin (4 bytes)"
1515
16+ # small.bson — binary BSON encoding of {"hello":"world","value":42} (exercises the binary BSON path)
17+ python3 -c "
18+ import struct, sys
19+
20+ def bson_string(key, val):
21+ k = key.encode() + b'\x00'
22+ v = val.encode() + b'\x00'
23+ return b'\x02' + k + struct.pack('<i', len(v)) + v
24+
25+ def bson_int32(key, val):
26+ k = key.encode() + b'\x00'
27+ return b'\x10' + k + struct.pack('<i', val)
28+
29+ body = bson_string('hello', 'world') + bson_int32('value', 42)
30+ doc = struct.pack('<i', 4 + 1 + len(body)) + body + b'\x00'
31+ sys.stdout.buffer.write(doc)
32+ " > small.bson
33+ echo " created small.bson ($( wc -c < small.bson) bytes)"
34+
1635# large.json — ~6 MB JSON array (exercises the large compressible path → S3 + zstd)
1736python3 -c "
1837import json, sys
You can’t perform that action at this time.
0 commit comments