test(handlers): add table-driven interface tests - #215
nathaniel-itential wants to merge 1 commit into
Conversation
Adds handler_table_test.go with a single TestHandlers_Interfaces function that validates every registered handler's commands against a central interfaceTable — checking command count, RunE wiring, and positional arg validation for all 10 handler archetypes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Currently tests are failing due to the issues mentioned in the PR summary, I will most likely get around to fixing some of those issues next week. I will keep this PR open for now and update when I fix the issues. |
|
@wcollins The tests for this are failing due to the fact that some tests are picking up that there are undefined methods (such as in methods.go runner, where there is no implementation for the describe method). This is due to in some cases an oversight in the api routes, where there is no existing api route. That being said, how should we handle this? Should we make the tests more granular, down to declared methods (get, describe, create) instead of interface (reader, writer, etc) |
|
@nathaniel-itential this PR failed CI. Please address and commit/push back. |
Description
Adds handler_table_test.go with a baseline global handler test, checking command count, RunE existence, and basic arg validation.
Ended up finding multiple issues with the existing description files, summarized below:
Type of Change
Changes Made
Adds a handler_table_test.go file that contains 3 main components: A interface table that stores the expected method for each handler interface (eg. Reader has Get and Describe commands), a handler table that has each handler with the types they are expected to be (Eg accounts is just a Reader), and a generic handler test that ensures there is the expected commands for a handler given the types, they have runE, and if they require args they have at least one declared.
Testing
Ran make build and ran the handler tests.
Checklist
make setupor relevant profiletype: subject)enhancement,bug,documentation,refactor,chore)