FTR - check ES security before creating system_indices_superuser (#124948)

This PR adds a check if ES security is enabled before creating the system_indices_superuser in the security service.
This commit is contained in:
Robert Oskamp 2022-02-08 16:32:10 +01:00 committed by GitHub
parent 535acb782c
commit befefc3347
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,16 @@ export async function createSystemIndicesUser(ctx: FtrProviderContext) {
const es = createEsClientForFtrConfig(config);
// There are cases where the test config file doesn't have security disabled
// but tests are still executed on ES without security. Checking this case
// by trying to fetch the users list.
try {
await es.security.getUser();
} catch (error) {
log.debug('Could not fetch users, assuming security is disabled');
return;
}
log.debug('===============creating system indices role and user===============');
await es.security.putRole({