From 72ccec0e71777f5add05cdc3e9910c483effa1b1 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 25 Apr 2025 05:28:52 +0100 Subject: [PATCH] Skip region validation in `S3BlobStoreRepositoryTests` 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 4f4eb24b5a9ca..b4279f8f0b07c 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 @@ -645,7 +645,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") )