Skip to content

Commit a346e27

Browse files
committed
Reinstate S3SearchableSnapshotsCredentialsReloadIT in FIPS JVMs
These tests only don't work in a FIPS JVM because they use a secret key that is unacceptably short. This commit replaces the relevant uses of `randomIdentifier` with `randomSecretKey` so they work whether in FIPS mode or not.
1 parent 95cf145 commit a346e27

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

x-pack/plugin/searchable-snapshots/qa/s3/src/javaRestTest/java/org/elasticsearch/xpack/searchablesnapshots/s3/S3SearchableSnapshotsCredentialsReloadIT.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.elasticsearch.test.rest.ObjectPath;
2828
import org.elasticsearch.xcontent.XContentBuilder;
2929
import org.elasticsearch.xcontent.XContentType;
30-
import org.junit.Before;
3130
import org.junit.ClassRule;
3231
import org.junit.rules.RuleChain;
3332
import org.junit.rules.TestRule;
@@ -75,11 +74,6 @@ protected String getTestRestCluster() {
7574
return cluster.getHttpAddresses();
7675
}
7776

78-
@Before
79-
public void skipFips() {
80-
assumeFalse("getting these tests to run in a FIPS JVM is kinda fiddly and we don't really need the extra coverage", inFipsJvm());
81-
}
82-
8377
public void testReloadCredentialsFromKeystore() throws IOException {
8478
final TestHarness testHarness = new TestHarness();
8579
testHarness.putRepository();
@@ -88,7 +82,7 @@ public void testReloadCredentialsFromKeystore() throws IOException {
8882
final String accessKey1 = randomIdentifier();
8983
repositoryAccessKey = accessKey1;
9084
keystoreSettings.put("s3.client.default.access_key", accessKey1);
91-
keystoreSettings.put("s3.client.default.secret_key", randomIdentifier());
85+
keystoreSettings.put("s3.client.default.secret_key", randomSecretKey());
9286
cluster.updateStoredSecureSettings();
9387
assertOK(client().performRequest(new Request("POST", "/_nodes/reload_secure_settings")));
9488

@@ -128,9 +122,9 @@ public void testReloadCredentialsFromAlternativeClient() throws IOException {
128122

129123
repositoryAccessKey = accessKey1;
130124
keystoreSettings.put("s3.client.default.access_key", accessKey1);
131-
keystoreSettings.put("s3.client.default.secret_key", randomIdentifier());
125+
keystoreSettings.put("s3.client.default.secret_key", randomSecretKey());
132126
keystoreSettings.put("s3.client." + alternativeClient + ".access_key", accessKey2);
133-
keystoreSettings.put("s3.client." + alternativeClient + ".secret_key", randomIdentifier());
127+
keystoreSettings.put("s3.client." + alternativeClient + ".secret_key", randomSecretKey());
134128
cluster.updateStoredSecureSettings();
135129
assertOK(client().performRequest(new Request("POST", "/_nodes/reload_secure_settings")));
136130

@@ -164,7 +158,7 @@ public void testReloadCredentialsFromMetadata() throws IOException {
164158
final String accessKey1 = randomIdentifier();
165159
final String accessKey2 = randomValueOtherThan(accessKey1, ESTestCase::randomIdentifier);
166160

167-
testHarness.putRepository(b -> b.put("access_key", accessKey1).put("secret_key", randomIdentifier()));
161+
testHarness.putRepository(b -> b.put("access_key", accessKey1).put("secret_key", randomSecretKey()));
168162
repositoryAccessKey = accessKey1;
169163

170164
testHarness.createFrozenSearchableSnapshotIndex();
@@ -182,7 +176,7 @@ public void testReloadCredentialsFromMetadata() throws IOException {
182176

183177
// Adjust repository to use new client
184178
logger.info("--> update repository metadata");
185-
testHarness.putRepository(b -> b.put("access_key", accessKey2).put("secret_key", randomIdentifier()));
179+
testHarness.putRepository(b -> b.put("access_key", accessKey2).put("secret_key", randomSecretKey()));
186180

187181
// Check access using refreshed credentials
188182
logger.info("--> expect success");

0 commit comments

Comments
 (0)