Skip to content

Commit e617c9d

Browse files
authored
Fix cross cluster test to use system agnostic path (#134843)
This commit fixes a cross cluster signing test that deals with an unknown configuration file to work on both *nix and windows.
1 parent f8d6754 commit e617c9d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/transport/CrossClusterSigningConfigReloaderIntegTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,16 @@ public void testRemoveFileWithConfig() throws Exception {
200200
}
201201

202202
public void testValidationFailsWhenUpdateWithInvalidPath() throws Exception {
203+
Path unknownFile = createTempDir().resolve("unknown_file");
203204
var exception = assertThrows(
204205
IllegalArgumentException.class,
205206
() -> updateClusterSettings(
206207
Settings.builder()
207-
.put(SIGNING_CERT_PATH.getConcreteSettingForNamespace("test").getKey(), "/unknown/path")
208-
.put(SIGNING_KEY_PATH.getConcreteSettingForNamespace("test").getKey(), "/unknown/path")
208+
.put(SIGNING_CERT_PATH.getConcreteSettingForNamespace("test").getKey(), unknownFile)
209+
.put(SIGNING_KEY_PATH.getConcreteSettingForNamespace("test").getKey(), unknownFile)
209210
)
210211
);
211-
assertThat(exception.getMessage(), equalTo("File [/unknown/path] configured for remote cluster [test] does no exist"));
212+
assertThat(exception.getMessage(), equalTo("File [" + unknownFile + "] configured for remote cluster [test] does no exist"));
212213
}
213214

214215
private void addAndRemoveClusterConfigsRuntime(

0 commit comments

Comments
 (0)