Skip to content

Update S3 and S3Control tests for auth scheme and endpoint resolution migration#6955

Open
S-Saranya1 wants to merge 2 commits into
feature/master/core-interceptors-migrationfrom
somepal/fix-s3-crossregion-and-s3control-tests
Open

Update S3 and S3Control tests for auth scheme and endpoint resolution migration#6955
S-Saranya1 wants to merge 2 commits into
feature/master/core-interceptors-migrationfrom
somepal/fix-s3-crossregion-and-s3control-tests

Conversation

@S-Saranya1
Copy link
Copy Markdown

@S-Saranya1 S-Saranya1 commented May 11, 2026

Motivation and Context

After moving auth scheme resolution and endpoint resolution from interceptors to pipeline stages (#6755, #6820), some tests that read resolved values (like endpoint URLs, signing properties, or auth scheme params) during interceptor hooks now get null or stale values, because resolution hasn't happened yet at that point.

Modifications

Test files that are updated

1. customization.config - There is an auto-generated test S3ClientEndpointTests.java (generated from endpoint-tests.json) that verifies the endpoint rules engine produces correct error messages for various inputs. One test case - "Access points when Access points explicitly disabled (used for CreateBucket)" expects the error: "Access points are not supported for this operation" from the endpoint rules engine.

Before migration: Endpoint resolution ran in an interceptor (modifyRequest) which was registered before CreateBucketInterceptor, so the endpoint rules error was thrown first matching the test expectation.

After migration: CreateBucketInterceptor.modifyRequest() runs first (interceptor phase) and validates the bucket name. It sees an ARN and throws its own validation error before EndpointResolutionStage (pipeline phase) gets a chance to run and return the expected error.

This test can't be modified because it's auto-generated from the endpoint rules test suite. Skipping it via customization.config with a comment explaining why.

2. S3ControlWireMockRerouteInterceptor.java - Capture resolved endpoint in beforeTransmission (from RESOLVED_ENDPOINT attribute) instead of modifyHttpRequest where endpoint isn't resolved yet.

3.UrlEncodingTest.java - Read SIGNER_DOUBLE_URL_ENCODE in beforeTransmission instead of beforeExecution, since the value is only available after auth scheme

4.S3CrossRegionAsyncClientTest.java, S3CrossRegionSyncClientTest.java - These tests verify that after a cross-region redirect (301), the client retries with the correct region. The test mocks the S3EndpointProvider and captures the S3EndpointParams passed to it.

After the migration, the mock endpoint provider gets called more times than before, once for the initial attempt (with the original region) and once for the retry (with the redirected region). Previously, the test asserted all captured calls had the redirected region. Now we assert only the last call, which is the final successful resolution.

Additionally, the cross-region client internally calls HeadBucket to discover the bucket's region. This call also triggers the capture interceptor, overwriting the captured endpoint provider with the default one (not the BucketEndpointProvider we want to assert). Fixed by skipping HeadBucket requests in the capture interceptor.

5. ListOfStringsAuthParamPluginTest.java — This test verifies that deleteObjectKeys (list of object keys from a DeleteObjects request) are correctly extracted and passed to the endpoint resolution logic.

Previously, the test used a plugin that wrapped the S3AuthSchemeProvider to capture the keys when auth scheme options were resolved. After the migration, auth scheme options resolution moved to the generated client code, which reads the provider directly from client configuration, bypassing the plugin-wrapped provider. So the plugin never captures the keys.

Fixed by calling S3EndpointResolverUtils.ruleParams() directly, the same method the generated code uses to extract endpoint params from the request. This tests the same extraction logic without depending on how the auth scheme provider is wired.

Testing

Make sure the modified tests pass

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@S-Saranya1 S-Saranya1 requested a review from a team as a code owner May 11, 2026 21:44
import software.amazon.awssdk.services.s3.model.Delete;
import software.amazon.awssdk.services.s3.model.DeleteObjectsRequest;
import software.amazon.awssdk.services.s3.model.ObjectIdentifier;
import software.amazon.awssdk.utils.AttributeMap;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate import

}

@Test
void callingDeleteObjects_requestWithCompleteListOfKey_returnsRightValues() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this test also be updated to use request POJO and S3EndpointParams instead of S3Client?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants