Commit 331c202
test(e2e): cover validation-limit rejections (#328)
* test(e2e): cover validation-limit rejections (#283)
PR #254 added configurable schema ingest limits (MaxFields, MaxDocBytes)
and PR #256 added JSON-Schema compile-time bounds. The validators have
unit tests; this lands the live e2e coverage of the user-facing
rejection paths.
Lower the docker-compose service's caps to small values
(SCHEMA_MAX_FIELDS=100, SCHEMA_MAX_DOC_BYTES=4096) so the new tests can
trip them with cheap payloads. Existing fixtures use at most a few
fields and well under 1 KiB of YAML, so other e2e tests are unaffected.
Add three tests in e2e/validation_limits_test.go:
- TestValidationLimits_MaxFieldsRejected — CreateSchema with 101 fields
returns InvalidArgument and the message cites the configured cap.
- TestValidationLimits_MaxFieldsAtLimitAccepted — exactly 100 fields is
accepted; the cap is inclusive at the limit.
- TestValidationLimits_MaxDocBytesRejected — ImportSchema with a YAML
body padded past the cap is rejected before the parser runs.
The JSON-Schema MaxDepth path is intentionally not covered here:
internal/validation/validator.go silently swallows newJSONSchemaValidator
errors at line 147 (constraints.JsonSchema branch), so a depth-exceeded
schema is accepted at CreateSchema and only surfaces later as a missing
JSON-Schema check. That swallow is worth a separate issue; the depth
trigger itself is unit-tested in internal/validation.
Closes #283
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 70053ba commit 331c202
2 files changed
Lines changed: 103 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
0 commit comments