Skip to content

Commit

Permalink
FTR - check ES security before creating system_indices_superuser (ela…
Browse files Browse the repository at this point in the history
…stic#124948) (elastic#124973)

This PR adds a check if ES security is enabled before creating the system_indices_superuser in the security service.

(cherry picked from commit befefc3)

Co-authored-by: Robert Oskamp <robert.oskamp@elastic.co>
  • Loading branch information
kibanamachine and pheyos authored Feb 8, 2022
1 parent 88a3d35 commit 9db4880
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/common/services/security/system_indices_user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 9db4880

Please sign in to comment.