test(handlers): add table-driven interface tests - #215
Open
nathaniel-itential wants to merge 1 commit into
Open
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>
Contributor
Author
|
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. |
Contributor
Author
|
@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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)