Skip to content

Commit b67587d

Browse files
delete outdated STS regional unit test
1 parent 9b69284 commit b67587d

File tree

2 files changed

+2
-32
lines changed

2 files changed

+2
-32
lines changed

modules/repository-s3/qa/web-identity-token/src/test/java/org/elasticsearch/repositories/s3/CustomWebIdentityTokenCredentialsProviderTests.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -227,34 +227,4 @@ public void testPickUpNewWebIdentityTokenWhenItsChanged() throws Exception {
227227
httpServer.stop(0);
228228
}
229229
}
230-
231-
public void testSupportRegionalizedEndpoints() throws Exception {
232-
Map<String, String> environmentVariables = Map.of(
233-
"AWS_WEB_IDENTITY_TOKEN_FILE",
234-
"/var/run/secrets/eks.amazonaws.com/serviceaccount/token",
235-
"AWS_ROLE_ARN",
236-
ROLE_ARN,
237-
"AWS_STS_REGIONAL_ENDPOINTS",
238-
"regional",
239-
"AWS_REGION",
240-
"us-west-2"
241-
);
242-
Map<String, String> systemProperties = Map.of();
243-
244-
var webIdentityTokenCredentialsProvider = new S3Service.CustomWebIdentityTokenCredentialsProvider(
245-
getEnvironment(),
246-
environmentVariables::get,
247-
systemProperties::getOrDefault,
248-
Clock.systemUTC(),
249-
resourceWatcherService
250-
);
251-
// We can't verify that webIdentityTokenCredentialsProvider's STS client uses the "https://sts.us-west-2.amazonaws.com"
252-
// endpoint in a unit test. The client depends on hardcoded RegionalEndpointsOptionResolver that in turn depends
253-
// on the system environment that we can't change in the test. So we just verify we that we called `withRegion`
254-
// on stsClientBuilder which should internally correctly configure the endpoint when the STS client is built.
255-
// TODO NOMERGE: can't access region anymore, need to rethink this.
256-
// assertEquals("us-west-2", webIdentityTokenCredentialsProvider.getStsRegion());
257-
258-
webIdentityTokenCredentialsProvider.close();
259-
}
260230
}

modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Service.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,6 @@ public CompletableFuture<? extends AwsCredentialsIdentity> resolveIdentity() {
481481
*/
482482
static class CustomWebIdentityTokenCredentialsProvider implements AwsCredentialsProvider {
483483

484-
private static final String STS_HOSTNAME = "https://sts.amazonaws.com";
485-
486484
static final String WEB_IDENTITY_TOKEN_FILE_LOCATION = "repository-s3/aws-web-identity-token-file";
487485

488486
private StsWebIdentityTokenFileCredentialsProvider credentialsProvider;
@@ -538,6 +536,8 @@ static class CustomWebIdentityTokenCredentialsProvider implements AwsCredentials
538536
);
539537

540538
{
539+
// TODO NOMERGE: is there any testing we need to add for this? We used to have a unit test that verified the regional stuff,
540+
// but we're using this endpoint override instead of region now.
541541
final var securityTokenServiceClientBuilder = StsClient.builder();
542542
final var endpointOverride = jvmEnvironment.getProperty("org.elasticsearch.repositories.s3.stsEndpointOverride", null);
543543
if (endpointOverride != null) {

0 commit comments

Comments
 (0)