test: add unit coverage for image registry service responses#5541
Closed
jyun-KIM wants to merge 1 commit into
Closed
test: add unit coverage for image registry service responses#5541jyun-KIM wants to merge 1 commit into
jyun-KIM wants to merge 1 commit into
Conversation
Add table-driven unit tests for the image_registry service covering the success and error paths of CreateImageRegistry, UpdateImageRegistry, DeleteImageRegistry, GetImageRegistry and ListImageRegistries. The tests wire the real Operator on top of the mocked MongoOperator and assert the mapped ImageRegistryResponse fields and error propagation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: jyun27 <kimjyun27@gmail.com>
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.
Proposed changes
This PR adds unit tests for the image registry service responses. The service in
chaoscenter/graphql/server/pkg/image_registry/service.goexposes five methods (CreateImageRegistry, UpdateImageRegistry, DeleteImageRegistry, GetImageRegistry, ListImageRegistries) that all returnmodel.ImageRegistryResponse, but had no unit test coverage.The new
pkg/image_registry/service_test.gowires the realOperatoron top of the existing mockedMongoOperator(following the pattern inpkg/chaos_experiment/ops/service_test.go) and uses table-driven tests to assert both the mapped response fields and error propagation for every method. List is additionally covered for multi-result, empty-result, and error cases.Local result: all subtests pass with 100% statement coverage of the package;
gofmtis clean.Fixes #5539
Types of changes
What types of changes does your code introduce to Litmus? Put an
xin the boxes that applyChecklist
Dependency
Special notes for your reviewer:
cd chaoscenter/graphql/server && go test -cover ./pkg/image_registry/...