pkg/bindings: Add tests for ToParams and helpers#28931
Open
ROKUMATE wants to merge 1 commit into
Open
Conversation
Fixes: podman-container-tools#28930 Signed-off-by: ROKUMATE <rohitkumawat0110@gmail.com>
Contributor
|
LGTM, assuming happy tests |
Contributor
Author
|
acc. to me the failing tests are not related to the pr i made as the pr aims for adding unit-test file (no production code change) and all unit jobs passed which are related to it ... |
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.
Fixes: #28930
What
Add unit tests for
pkg/bindings/internal/util:ToParams,Changed,IsSimpleType, andSimpleTypeToParam. These had no test coverage.Why
ToParamsbuilds the URL query parameters for every binding call, so itsbehavior matters broadly and is easy to regress: only non-nil fields are
emitted, the
schematag renames a param (and-omits it), simple types andfmt.Stringerbecome a single value, slices become repeated values, and mapsare serialized to JSON. The tests lock this in.
Details
Table-driven tests in
pkg/bindings/internal/util/util_test.gocovering:non-simple types
maps (JSON), schema-tag rename and "-" omission, and the slice-of-non-simple
error path
No production code changes.
go test ./pkg/bindings/internal/util/passes.