Skip to content

Commit

Permalink
[Test] Only excercise assertions when necessary (elastic#82698)
Browse files Browse the repository at this point in the history
In negative caching test, the actual number of invocations can be zero.
When that happens, there is no need to run the assertions.

Resolves: elastic#82656
  • Loading branch information
ywangd authored Jan 18, 2022
1 parent 223e375 commit 8cddea0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ public void testNegativeLookupsAreCached() {
assertThat(effectiveRoleDescriptors.get(), is(nullValue()));
}
}
if (getSuperuserRole) {
if (numberOfTimesToCall > 0 && getSuperuserRole) {
verify(nativePrivilegeStore).getPrivileges(eq(Set.of("*")), eq(Set.of("*")), anyActionListener());
// We can't verify the contents of the Set here because the set is mutated inside the method
verify(reservedRolesStore, times(2)).accept(anySet(), anyActionListener());
Expand Down

0 comments on commit 8cddea0

Please sign in to comment.