Skip to content

Commit e1a69dc

Browse files
Fallout from #31261 in tests
1 parent 5031330 commit e1a69dc

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

server/src/test/java/org/elasticsearch/action/admin/ReloadSecureSettingsIT.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.action.admin.cluster.node.reload.NodesReloadSecureSettingsResponse;
2525
import org.elasticsearch.common.settings.KeyStoreWrapper;
2626
import org.elasticsearch.common.settings.SecureSettings;
27+
import org.elasticsearch.common.settings.SecureString;
2728
import org.elasticsearch.common.settings.Settings;
2829
import org.elasticsearch.env.Environment;
2930
import org.elasticsearch.plugins.Plugin;
@@ -62,7 +63,7 @@ public void testMissingKeystoreFile() throws Exception {
6263
Files.deleteIfExists(KeyStoreWrapper.keystorePath(environment.configFile()));
6364
final int initialReloadCount = mockReloadablePlugin.getReloadCount();
6465
final CountDownLatch latch = new CountDownLatch(1);
65-
client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword("").execute(
66+
client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword(new SecureString(new char[0])).execute(
6667
new ActionListener<NodesReloadSecureSettingsResponse>() {
6768
@Override
6869
public void onResponse(NodesReloadSecureSettingsResponse nodesReloadResponse) {
@@ -149,7 +150,7 @@ public void testInvalidKeystoreFile() throws Exception {
149150
Files.copy(keystore, KeyStoreWrapper.keystorePath(environment.configFile()), StandardCopyOption.REPLACE_EXISTING);
150151
}
151152
final CountDownLatch latch = new CountDownLatch(1);
152-
client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword("").execute(
153+
client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword(new SecureString(new char[0])).execute(
153154
new ActionListener<NodesReloadSecureSettingsResponse>() {
154155
@Override
155156
public void onResponse(NodesReloadSecureSettingsResponse nodesReloadResponse) {
@@ -191,8 +192,11 @@ public void testWrongKeystorePassword() throws Exception {
191192
// "some" keystore should be present in this case
192193
writeEmptyKeystore(environment, new char[0]);
193194
final CountDownLatch latch = new CountDownLatch(1);
194-
client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword("Wrong password here").execute(
195-
new ActionListener<NodesReloadSecureSettingsResponse>() {
195+
client().admin()
196+
.cluster()
197+
.prepareReloadSecureSettings()
198+
.setSecureStorePassword(new SecureString(new char[] { 'W', 'r', 'o', 'n', 'g' }))
199+
.execute(new ActionListener<NodesReloadSecureSettingsResponse>() {
196200
@Override
197201
public void onResponse(NodesReloadSecureSettingsResponse nodesReloadResponse) {
198202
try {
@@ -244,7 +248,7 @@ public void testMisbehavingPlugin() throws Exception {
244248
.get(Settings.builder().put(environment.settings()).setSecureSettings(secureSettings).build())
245249
.toString();
246250
final CountDownLatch latch = new CountDownLatch(1);
247-
client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword("").execute(
251+
client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword(new SecureString(new char[0])).execute(
248252
new ActionListener<NodesReloadSecureSettingsResponse>() {
249253
@Override
250254
public void onResponse(NodesReloadSecureSettingsResponse nodesReloadResponse) {
@@ -311,7 +315,7 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
311315
private void successfulReloadCall() throws InterruptedException {
312316
final AtomicReference<AssertionError> reloadSettingsError = new AtomicReference<>();
313317
final CountDownLatch latch = new CountDownLatch(1);
314-
client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword("").execute(
318+
client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword(new SecureString(new char[0])).execute(
315319
new ActionListener<NodesReloadSecureSettingsResponse>() {
316320
@Override
317321
public void onResponse(NodesReloadSecureSettingsResponse nodesReloadResponse) {

0 commit comments

Comments
 (0)