Skip to content

Commit 9848a60

Browse files
fix flaky testInvalidToken (#133380)
1 parent 3b70858 commit 9848a60

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,6 +1980,11 @@ public void testInvalidToken() throws Exception {
19801980
when(projectIndex.getUnavailableReason(any())).thenReturn(new ElasticsearchException(getTestName()));
19811981
} else {
19821982
when(projectIndex.isAvailable(any())).thenReturn(true);
1983+
doAnswer(invocationOnMock -> {
1984+
Runnable runnable = (Runnable) invocationOnMock.getArguments()[1];
1985+
runnable.run();
1986+
return null;
1987+
}).when(projectIndex).checkIndexVersionThenExecute(anyConsumer(), any(Runnable.class));
19831988
doAnswer(inv -> {
19841989
final GetRequest request = inv.getArgument(0);
19851990
final ActionListener<GetResponse> listener = inv.getArgument(1);

0 commit comments

Comments
 (0)