Skip to content

Commit 4176fdf

Browse files
Update x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/ApiKeyServiceTests.java
Co-authored-by: Slobodan Adamović <[email protected]>
1 parent 6f010b8 commit 4176fdf

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/ApiKeyServiceTests.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,16 +2564,8 @@ public void testCreationFailsIfAuthenticationIsCloudApiKey() throws InterruptedE
25642564
ApiKeyService service = createApiKeyService(Settings.EMPTY);
25652565
final PlainActionFuture<CreateApiKeyResponse> future = new PlainActionFuture<>();
25662566
service.createApiKey(authentication, createApiKeyRequest, Set.of(), future);
2567-
assertEquals(true, future.isDone());
2568-
assertThrows(ExecutionException.class, future::get);
2569-
try {
2570-
future.get();
2571-
} catch (ExecutionException ex) {
2572-
assertEquals(
2573-
"java.lang.IllegalArgumentException: creating elasticsearch api keys using cloud api keys is not supported",
2574-
ex.getMessage()
2575-
);
2576-
}
2567+
final IllegalArgumentException iae = expectThrows(IllegalArgumentException.class, future);
2568+
assertThat(iae.getMessage(), equalTo("creating elasticsearch api keys using cloud api keys is not supported"));
25772569
}
25782570

25792571
public void testCachedApiKeyValidationWillNotBeBlockedByUnCachedApiKey() throws IOException, ExecutionException, InterruptedException {

0 commit comments

Comments
 (0)