test: remove check in ClearRolesCacheTests that is prone to failure
This removes a check in the ClearRolesCacheTests that is prone to failure due to the possibility of the cache poller running while we modify documents and updating cached values prior to the test issuing the get roles call. See elastic/elasticsearch#1354 Original commit: elastic/x-pack-elasticsearch@ba0b803466
This commit is contained in:
parent
d02ddece8f
commit
ed7c4273c3
|
@ -88,7 +88,7 @@ public class ClearRolesCacheTests extends ShieldIntegTestCase {
|
||||||
logger.debug("--> created role [{}]", role);
|
logger.debug("--> created role [{}]", role);
|
||||||
}
|
}
|
||||||
|
|
||||||
ensureYellow(ShieldTemplateService.SHIELD_ADMIN_INDEX_NAME);
|
ensureGreen(ShieldTemplateService.SHIELD_ADMIN_INDEX_NAME);
|
||||||
|
|
||||||
// warm up the caches on every node
|
// warm up the caches on every node
|
||||||
for (ESNativeRolesStore rolesStore : internalCluster().getInstances(ESNativeRolesStore.class)) {
|
for (ESNativeRolesStore rolesStore : internalCluster().getInstances(ESNativeRolesStore.class)) {
|
||||||
|
@ -127,7 +127,7 @@ public class ClearRolesCacheTests extends ShieldIntegTestCase {
|
||||||
assertRolesAreCorrect(shieldClient, toModify);
|
assertRolesAreCorrect(shieldClient, toModify);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testModifyingDocumentsDirectlyAndClearingCache() throws Exception {
|
public void testModifyingDocumentsDirectly() throws Exception {
|
||||||
Client client = internalCluster().transportClient();
|
Client client = internalCluster().transportClient();
|
||||||
|
|
||||||
int modifiedRolesCount = randomIntBetween(1, roles.length);
|
int modifiedRolesCount = randomIntBetween(1, roles.length);
|
||||||
|
@ -142,14 +142,9 @@ public class ClearRolesCacheTests extends ShieldIntegTestCase {
|
||||||
logger.debug("--> updated role [{}] with run_as", role);
|
logger.debug("--> updated role [{}] with run_as", role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// in this test, the poller runs too frequently to check the cache still has roles without run as
|
||||||
|
// clear the cache and we should definitely see the latest values!
|
||||||
ShieldClient shieldClient = new ShieldClient(client);
|
ShieldClient shieldClient = new ShieldClient(client);
|
||||||
for (String role : roles) {
|
|
||||||
GetRolesResponse roleResponse = shieldClient.prepareGetRoles().roles(role).get();
|
|
||||||
assertThat(roleResponse.isExists(), is(true));
|
|
||||||
final String[] runAs = roleResponse.roles().get(0).getRunAs();
|
|
||||||
assertThat("role [" + role + "] should be cached and no rules have run as set", runAs == null || runAs.length == 0, is(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean useHttp = randomBoolean();
|
final boolean useHttp = randomBoolean();
|
||||||
final boolean clearAll = randomBoolean();
|
final boolean clearAll = randomBoolean();
|
||||||
logger.debug("--> starting to clear roles. using http [{}] clearing all [{}]", useHttp, clearAll);
|
logger.debug("--> starting to clear roles. using http [{}] clearing all [{}]", useHttp, clearAll);
|
||||||
|
|
Loading…
Reference in New Issue