test(message/s3): unit + Garage integration tests for S3 adapter (#531) - #535
Open
Anthony-Bible wants to merge 1 commit into
Open
test(message/s3): unit + Garage integration tests for S3 adapter (#531)#535Anthony-Bible wants to merge 1 commit into
Anthony-Bible wants to merge 1 commit into
Conversation
Seam refactor (object_storage.go): introduce unexported interfaces multipartCore, objectGetter, and readerStat so *minio.Core/*minio.Client can be replaced with function-field fakes in tests. NewS3Adapter signature and all method behaviours are unchanged; forms.go untouched. 14 unit tests (object_storage_test.go): cover every public method — happy paths, error propagation, contracts.CompletedPart→minio.CompletePart ordering, and the close-on-Stat-error invariant for GetObject. Garage integration helper (internal/integration/garagetest/garage.go, integration build tag): spins up dxflrs/garage:v1.0.1 via testcontainers generic container and provisions a bucket + access key. Exposes both StartGarage(t) for per-test use and MustStart() for TestMain. Image defaults to docker.io/dxflrs/garage:v1.0.1 (not on mirror.gcr.io — noted in comment) with PASSWORDEXCHANGE_TEST_GARAGE_IMAGE override. 4 blackbox integration tests share one container via TestMain: multipart round-trip (5 MiB min-part + 1 KiB final, SHA-256 verified), abort discards upload, missing-key error, and bad-ETag rejection on complete. Note: the issue mentioned DeleteObject but neither ObjectStoragePort nor S3Adapter defines that method — the issue text is stale. Tests cover the 5 real methods only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Anthony-Bible
force-pushed
the
test/531-s3-adapter-tests
branch
from
June 5, 2026 13:42
1a17ee5 to
5f72400
Compare
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.
Summary
object_storage.go): introduce unexported interfacesmultipartCore,objectGetter, andreaderStatso*minio.Core/*minio.Clientcan be swapped with fakes in tests.NewS3Adaptersignature and all method behaviours are unchanged;forms.gountouched.object_storage_test.go): function-field fakes +testify/require/assert, covering every public method — happy paths, error propagation,contracts.CompletedPart→minio.CompletePartordering, and the close-on-Stat-error invariant forGetObject.internal/integration/garagetest/garage.go,integrationbuild tag): spins updxflrs/garage:v1.0.1via testcontainers generic container, provisions bucket + key, tears down viat.Cleanup. Image defaults todocker.io/dxflrs/garage:v1.0.1(not onmirror.gcr.io— noted in comment) withPASSWORDEXCHANGE_TEST_GARAGE_IMAGEoverride.object_storage_integration_test.go): multipart round-trip (5 MiB min-part + 1 KiB final, SHA-256 verified), abort discards upload, missing-key error, and bad-ETag rejection on complete.Test plan
cd app && go test ./internal/domains/message/adapters/secondary/s3/... -v— 14 unit tests passcd app && go test -tags=integration ./internal/domains/message/adapters/secondary/s3/... -v— 4 Garage integration tests pass (requires Docker)cd app && go test ./...— full unit suite still green./test-build.sh— build verification passes🤖 Generated with Claude Code