feat: Go V3 test server; rename Java and Python as "V3" implementations#4
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a Go V3 test server implementation and renames existing Java and Python servers to explicitly indicate they are "V3" implementations, setting up the framework for cross-version testing of S3 Encryption Client implementations.
- Add complete Go V3 test server with HTTP endpoints for client creation and S3 object operations
- Rename Java and Python servers from generic names to "V3" specific versions
- Update test infrastructure to support the new Go server and handle encryption context validation differences
Reviewed Changes
Copilot reviewed 7 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test-server/java-v3-server/README.md | Updates documentation to reflect V3 naming |
| test-server/java-tests/src/it/java/software/amazon/encryption/s3/RoundTripTests.java | Adds Go-V3 server support and new encryption context validation tests |
| test-server/go-v3-server/main.go | New Go test server implementation with full S3EC functionality |
| test-server/go-v3-server/go.mod | Go module definition with required dependencies |
| test-server/go-v3-server/README.md | Documentation for the new Go test server |
| test-server/README.md | Updated instructions for V3 server naming |
| test-server/Makefile | Updated build targets to support all three V3 servers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ctx := context.Background() | ||
| encryptionContext := context.WithValue(ctx, "EncryptionContext", encCtx) |
There was a problem hiding this comment.
Similar to the PUT operation, the encryption context is being added to the Go context but may not be used by the S3 encryption client for validation during decryption. The comment on lines 309-310 suggests this implementation doesn't validate encryption context, which may be due to this incorrect usage.
| ctx := context.Background() | |
| encryptionContext := context.WithValue(ctx, "EncryptionContext", encCtx) |
There was a problem hiding this comment.
Correct, I could go either way here.
I'll probably leave it in so the test server behavior explicitly mirrors that of other test servers, but will defer to reviewers' opinions.
|
|
||
| // Generate client ID | ||
| clientID := uuid.New().String() | ||
| log.Printf("CreateClient: Generated client ID: %s", clientID) |
There was a problem hiding this comment.
I'm fine with keeping some print logging, but I think we should be more concise than we are now.
Also, let's add a [Go v3] prefix or similar to differentiate it from other servers.
There was a problem hiding this comment.
Reduced logging to only either log error or success
…s3/RoundTripTests.java Co-authored-by: Kess Plasmeier <76071473+kessplas@users.noreply.github.com>
…s3/RoundTripTests.java Co-authored-by: Kess Plasmeier <76071473+kessplas@users.noreply.github.com>
…client-python into go-test-server
kessplas
left a comment
There was a problem hiding this comment.
LGTM, please have Shubham take a look as well
ShubhamChaturvedi7
left a comment
There was a problem hiding this comment.
Nothing major; Approving since this PR is building block of other changes that need to go, the comments can be addressed as a follow up PR.
|
|
||
| - **HTTP Framework**: Gorilla Mux for routing | ||
| - **AWS SDK**: AWS SDK for Go v2 for S3 and KMS operations | ||
| - **Concurrency**: Thread-safe client caching with sync.RWMutex |
There was a problem hiding this comment.
Is it being used anywhere? I see the cache is plain map (which I guess works; see my comment below).
There was a problem hiding this comment.
Oops sorry AI slop slipped through, will remove
| ) | ||
|
|
||
| // Server represents the Go test server | ||
| type Server struct { |
There was a problem hiding this comment.
nit / optional: you can make them all private (structs) if it's all in the same package.
| keyring := materials.NewKmsKeyring(kmsClient, input.Config.KeyMaterial.KMSKeyID, func(options *materials.KeyringOptions) { | ||
| options.EnableLegacyWrappingAlgorithms = input.Config.EnableLegacyWrappingAlgorithms |
There was a problem hiding this comment.
What about other values in the input config? Do we not use them?
There was a problem hiding this comment.
The existing Java and Python implementations don't, so I'm mirroring those
| serverList = new ArrayList<>(14); | ||
| serverList.add(new LanguageServerTarget("Java-V3", "8080")); | ||
| serverList.add(new LanguageServerTarget("Python-V3", "8081")); | ||
| serverList.add(new LanguageServerTarget("Go-V3", "8082")); | ||
|
|
||
| serverMap = new HashMap<>(14); | ||
| serverMap.put("Java-V3", new LanguageServerTarget("Java-V3", "8080")); | ||
| serverMap.put("Python-V3", new LanguageServerTarget("Python-V3", "8081")); | ||
| serverMap.put("Go-V3", new LanguageServerTarget("Go-V3", "8082")); |
There was a problem hiding this comment.
Why list and map both? It'd be a bit less maintenance if it was just a map (and iterate over the valueSet).
There was a problem hiding this comment.
I'm not sure but I'll leave this as-is
| clientID := uuid.New().String() | ||
|
|
||
| // Store client in cache | ||
| s.clientCache[clientID] = s3EncryptionClient |
There was a problem hiding this comment.
So we are safe against multi-threading because each request would just create a new uuid. Cool.
|
I'll merge since my only change since 2 approvals is cleaning up the README. |
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.