serde/json/test: add JSONTestSuite parsing conformance suite#30211
serde/json/test: add JSONTestSuite parsing conformance suite#30211nvartolomei merged 2 commits intoredpanda-data:devfrom
Conversation
|
Can we instead pull it in via bazel instead of vendoring in a bunch of files? |
|
@rockwotj didn't want to add extra (flaky) dependency in test run. |
You could vendor into our s3 bucket. There are already lots of things in github we depend on and we really need to have some ability to automatically mirror |
|
Why not vendor (source control) a bunch of files instead? 300 KB of blobs. |
|
Why not vendor everything 😄 Personally I think not vendoring is more consistent, and practically speaking these will never get updated if we vendor, where I think if all you have to do is bump a sha it's much less work to update |
4a683b4 to
16595c3
Compare
There was a problem hiding this comment.
Pull request overview
Adds automated JSON parsing conformance coverage by integrating the upstream JSONTestSuite corpus into the existing serde/json gtest-based test suite, and refactors local jsonchecker test-case discovery into a reusable helper.
Changes:
- Extend
test_utils::get_runfile_pathto support locating runfiles from external Bazel repositories via arepoparameter. - Add a shared helper to enumerate
.jsontest vectors and use it from existing/new parameterized tests. - Add a new parameterized gtest that runs the
nst/JSONTestSuitetest_parsingcorpus via a newhttp_archive.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/v/test_utils/runfiles.h | Update runfiles helper API to accept an optional repo name and document external repo usage. |
| src/v/test_utils/runfiles.cc | Implement repo-aware Rlocation path construction. |
| src/v/serde/json/tests/test_cases.h | New helper to collect and sort .json test cases from a directory. |
| src/v/serde/json/tests/json_test_suite_test.cc | New parameterized test running JSONTestSuite test_parsing corpus. |
| src/v/serde/json/tests/json_checker_test.cc | Refactor to use shared test-case collection helper and path-based params. |
| src/v/serde/json/tests/BUILD | Add test_cases test library and new json_test_suite_test target; wire data/deps. |
| MODULE.bazel | Add nst_json_test_suite http_archive with a filegroup exposing test_parsing JSON corpus. |
Split the testdata directory scan out of json_checker_test.cc so that future parameterized JSON parser test suites can reuse it. The helper returns full file paths — callers derive the filename locally rather than re-joining the test data directory.
16595c3 to
70b44bf
Compare
Fetch the test_parsing corpus from https://github.com/nst/JSONTestSuite (MIT, Nicolas Seriot) via a pinned http_archive and run it as a parameterized gtest. File-name prefixes encode the expected parser behavior per RFC 8259: y_ must be accepted, n_ must be rejected, i_ is implementation-defined (the parser just must not crash). The current parser passes all 318 cases with default config. get_runfile_path gains an optional repo parameter (default _main) so callers can resolve data from external Bazel repositories.
70b44bf to
9b91321
Compare
Vendor the test_parsing corpus from https://github.com/nst/JSONTestSuite
(MIT, Nicolas Seriot) and run it as a parameterized gtest. File-name
prefixes encode the expected parser behavior per RFC 8259: y_ must be
accepted, n_ must be rejected, i_ is implementation-defined (the parser
just must not crash).
The current parser passes all 318 cases with default config.
Backports Required
Release Notes