Skip to content

Commit

Permalink
adjust test as elastic#54532 is not backported to 7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jkakavas committed Apr 27, 2020
1 parent 3a19671 commit a2f969d
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@ public void testExpiredTokensDeletedAfterExpiration() throws Exception {
assertBusy(() -> {
if (deleteTriggered.compareAndSet(false, true)) {
// invalidate a invalid token... doesn't matter that it is bad... we just want this action to trigger the deletion
InvalidateTokenResponse invalidateResponseTwo = securityClient.prepareInvalidateToken("fooobar")
.setType(randomFrom(InvalidateTokenRequest.Type.values()))
.execute()
.actionGet();
assertThat(invalidateResponseTwo.getResult().getInvalidatedTokens(), equalTo(0));
assertThat(invalidateResponseTwo.getResult().getPreviouslyInvalidatedTokens(), equalTo(0));
assertThat(invalidateResponseTwo.getResult().getErrors().size(), equalTo(0));
try {
securityClient.prepareInvalidateToken("fooobar")
.setType(randomFrom(InvalidateTokenRequest.Type.values()))
.execute()
.actionGet();
} catch (ElasticsearchSecurityException e) {
assertEquals("token malformed", e.getMessage());
assertThat(e.status(), equalTo(RestStatus.UNAUTHORIZED));
}
}
client.admin().indices().prepareRefresh(RestrictedIndicesNames.SECURITY_TOKENS_ALIAS).get();
SearchResponse searchResponse = client.prepareSearch(RestrictedIndicesNames.SECURITY_TOKENS_ALIAS)
Expand Down

0 comments on commit a2f969d

Please sign in to comment.