chore: refactor all tests by category - #2260
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Greptile SummaryThis PR successfully reorganizes the internal test directory from an organic, issue-numbered structure into a clean feature-based taxonomy. The refactoring deletes 52k lines while adding only 10k, demonstrating significant simplification. Key improvements:
Test coverage: Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| internal/test/tools.go | Added tools.go with go:build constraint to keep oapi-codegen dependency in go.mod for go:generate directives |
| internal/test/go.mod | Cleaned up dependencies, removing unused framework imports (gin, iris, gorilla, etc.) |
| internal/test/components/primitives/primitives_test.go | Comprehensive tests for primitive types, enums, formats, and JSON round-trip serialization |
| internal/test/parameters/path/simple/path_simple_test.go | Thorough testing of simple-style path parameters with explode/noExplode for primitives, arrays, and objects |
| internal/test/externalref/externalref_test.go | Tests external ref qualification in responses (issue-2113), verifying proper package import |
| internal/test/externalref/config.api.yaml | API config with import-mapping for external common package references |
Last reviewed commit: 5d69e3b
|
This code review is quite immense. It might be easier to look at my source branch to see what the layout looks like. I think it will be a lot easier to add test cases for specific things once this is merged. |
|
@mromaszewicz would you like this change in before any other PRs? What's your priority order for these to avoid conflcits/rebasing fun? |
|
I will use AI to rebase this, it shines there. I'd like to get this in just as a quality of life improvement. It exposed some issues we have with matrix and label parameters as-is (so tests are disabled for now). |
6368d27 to
bcf95c1
Compare
|
A couple of things:
Otherwise LGTM, let's get this quality-of-life improvement in! |
|
A lot of work has happened since this commit, I will rebase it and re-do it once 2.8.0 is out. It'll be a lot of work. |
|
I'm revisiting this. The code has drifted hugely, so I'm basically re-doing it, and doing it a little more cleanly this time. We won't be needing the per-issue test dirs. I really hope to avoid them, and the new top level categories should cover more bases. It's easier to add some edge case to an existing spec than to make a whole new test dir. Most of that code is wasted boilerplate. |
bcf95c1 to
4ebe69e
Compare
|
@greptileai - review. |
|
Too many files changed for review. ( |
4ebe69e to
21ec07d
Compare
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reorganize internal/test into feature categories (schemas, aggregates, parameters, bodies, servers, clients, events, references, extensions, options, naming, openapi31). Previously the tests sprawled across 56 issues/issue-NNNN directories and a couple of kitchen-sink specs, plus ~24 nearly identical per-framework directories that regenerated large amounts of near-duplicate boilerplate. Each test is now a focused unit under its category, sharing a single spec / client / table-driven harness per concern instead of duplicating generated code for every framework. The old issues/, per-framework, and kitchen-sink directories are removed; the category layout is the only test structure. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bring the test refactor up to date with HEAD, and fold in new test issues into the unified test framework.
Update comments to reflect original source tests in each merged spec, and consolidate some more, where possible.
Tell Greptile about the new test organization, so it helps people place tests correctly in the future.
21ec07d to
56fa375
Compare
Replace the organically grown layout — 56 issues/issue-NNNN directories
plus a few kitchen-sink specs — with 13 feature categories (schemas,
aggregates, parameters, bodies, servers, clients, events, references,
extensions, options, naming, openapi31, spec_validation).
Each scenario is now a focused spec/config/test unit under its category,
named for what it tests rather than an issue number, with issue context
kept as "From issue-NNNN" comments in the absorbing spec. Cross-framework
suites (parameters/roundtrip, servers/strict, events/webhooks,
servers/routers/smoke) share one spec and one table-driven harness per
concern; only the per-framework server/types generation remains
duplicated, since generated servers cannot share packages.
Coverage was audited directory-by-directory against the old tree: nothing
was dropped, and three previously lost areas were restored (hand-crafted
wire-format parameter binding, operationId name-normalization,
nil-vs-empty query array serialization). Greptile review rules now
enforce the category placement so issue directories don't return.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Co-Authored-By: Claude Fable 5 noreply@anthropic.com