From 9ee1e233d3b64a258f45d19fdde4626ecffa4c79 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 25 Apr 2025 08:55:47 +0100 Subject: [PATCH] Skip region validation in `S3BlobStoreRepositoryTests` (#127372) Today these tests assert that the requests received by the handler are signed in region `us-east-1` with no region specified, but in fact when running in EC2 the SDK will pick up the actual region which may be different. This commit skips this region validation for now (it is tested elsewhere). --- .../repositories/s3/S3BlobStoreRepositoryTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/repository-s3/src/internalClusterTest/java/org/elasticsearch/repositories/s3/S3BlobStoreRepositoryTests.java b/modules/repository-s3/src/internalClusterTest/java/org/elasticsearch/repositories/s3/S3BlobStoreRepositoryTests.java index 90b33842c93ce..2e2aaef021b5e 100644 --- a/modules/repository-s3/src/internalClusterTest/java/org/elasticsearch/repositories/s3/S3BlobStoreRepositoryTests.java +++ b/modules/repository-s3/src/internalClusterTest/java/org/elasticsearch/repositories/s3/S3BlobStoreRepositoryTests.java @@ -617,7 +617,9 @@ public void handle(final HttpExchange exchange) throws IOException { assertTrue( isValidAwsV4SignedAuthorizationHeader( "test_access_key", - Objects.requireNonNullElse(region, "us-east-1"), + // If unset, the region used by the SDK is usually going to be `us-east-1` but sometimes these tests run on bare EC2 + // machines and the SDK picks up the region from the IMDS there, so for now we use '*' to skip validation. + Objects.requireNonNullElse(region, "*"), "s3", exchange.getRequestHeaders().getFirst("Authorization") )