Skip to content

Commit d8892ac

Browse files
committed
Comments
1 parent 4ae3f54 commit d8892ac

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

plugins/discovery-ec2/src/javaRestTest/java/org/elasticsearch/discovery/ec2/DiscoveryEc2InstanceProfileIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
public class DiscoveryEc2InstanceProfileIT extends DiscoveryEc2ClusterFormationTestCase {
3030

31+
// Lazy-initialized so we can generate it randomly, which is not possible in static context.
3132
private static final Supplier<String> regionSupplier = new LazyInitializable<>(ESTestCase::randomIdentifier)::getOrCompute;
3233

3334
private static final DynamicAwsCredentials dynamicCredentials = new DynamicAwsCredentials(regionSupplier, "ec2");

test/fixtures/aws-fixture-utils/src/main/java/fixture/aws/DynamicAwsCredentials.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,21 @@
2323
*/
2424
public class DynamicAwsCredentials {
2525

26+
/**
27+
* Extra validation that requests are signed using the correct region. Lazy so it can be randomly generated after initialization, since
28+
* randomness is not available in static context.
29+
*/
2630
private final Supplier<String> expectedRegionSupplier;
31+
32+
/**
33+
* Extra validation that requests are directed to the correct service.
34+
*/
2735
private final String expectedServiceName;
36+
37+
/**
38+
* The set of access keys for each session token registered with {@link #addValidCredentials}. It's this way round because the session
39+
* token is a separate header so it's easier to extract.
40+
*/
2841
private final Map<String, Set<String>> validCredentialsMap = ConcurrentCollections.newConcurrentMap();
2942

3043
/**

0 commit comments

Comments
 (0)