Skip to content

Commit

Permalink
do not reuse request object
Browse files Browse the repository at this point in the history
  • Loading branch information
ywangd committed Nov 28, 2024
1 parent 15e0fbc commit 9bf89f4
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,8 @@ public void testReloadCredentialsFromKeystore() throws IOException {
keystoreSettings.put("s3.client.default.access_key", accessKey1);
keystoreSettings.put("s3.client.default.secret_key", randomSecretKey());
cluster.updateStoredSecureSettings();
final Request reloadSecureSettingsRequest = newXContentRequest(
HttpMethod.POST,
"/_nodes/reload_secure_settings",
(b, p) -> b.field("secure_settings_password", "keystore-password")
);
assertOK(client().performRequest(reloadSecureSettingsRequest));

assertOK(client().performRequest(createReloadSecureSettingsRequest()));

// Check access using initial credentials
assertOK(client().performRequest(verifyRequest));
Expand All @@ -103,10 +99,17 @@ public void testReloadCredentialsFromKeystore() throws IOException {
// Set up refreshed credentials
keystoreSettings.put("s3.client.default.access_key", accessKey2);
cluster.updateStoredSecureSettings();
assertOK(client().performRequest(reloadSecureSettingsRequest));
assertOK(client().performRequest(createReloadSecureSettingsRequest()));

// Check access using refreshed credentials
assertOK(client().performRequest(verifyRequest));
}

private Request createReloadSecureSettingsRequest() throws IOException {
return newXContentRequest(
HttpMethod.POST,
"/_nodes/reload_secure_settings",
(b, p) -> inFipsJvm() ? b.field("secure_settings_password", "keystore-password") : b
);
}
}

0 comments on commit 9bf89f4

Please sign in to comment.