From 5de42351d61c96a1297a1fd80a642f62d17af3f6 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Fri, 5 Apr 2024 10:53:09 -0400 Subject: [PATCH] Remove references to `system_indices_superuser` from Synthetics API tests. --- .../synthetics/synthetics_enablement.ts | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/synthetics/synthetics_enablement.ts b/x-pack/test_serverless/api_integration/test_suites/observability/synthetics/synthetics_enablement.ts index 597cbf7582b67..a6f2eeb082ccd 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/synthetics/synthetics_enablement.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/synthetics/synthetics_enablement.ts @@ -81,7 +81,7 @@ export default function ({ getService }: FtrProviderContext) { } describe('[PUT] /internal/uptime/service/enablement', () => { - const roles: RoleName[] = ['admin', 'editor', 'system_indices_superuser', 'viewer']; + const roles: RoleName[] = ['admin', 'editor', 'viewer']; roles.forEach((role) => { it(`${role} role has appropriate permissions for API keys`, async () => { @@ -91,7 +91,7 @@ export default function ({ getService }: FtrProviderContext) { const { body } = await enablementPut(role); - if (['system_indices_superuser', 'admin'].indexOf(role) !== -1) { + if (['admin'].indexOf(role) !== -1) { expect(body).to.eql(ALL_ENABLED); } else { expect(body).to.eql({ @@ -166,13 +166,13 @@ export default function ({ getService }: FtrProviderContext) { beforeEach(async () => { const apiKeys = await getApiKeys(); if (apiKeys.length) { - await enablementDelete('system_indices_superuser'); + await enablementDelete(); } }); it('admin can delete api key', async () => { - await enablementPut('system_indices_superuser'); + await enablementPut(); - const delResponse = await enablementDelete('system_indices_superuser'); + const delResponse = await enablementDelete(); expect(delResponse.body).eql({}); const apiResponse = await enablementPut(); @@ -180,7 +180,7 @@ export default function ({ getService }: FtrProviderContext) { expect(apiResponse.body).eql(ALL_ENABLED); }); - it('with an editor user', async () => { + it('editor user cannot delete API key', async () => { await enablementPut(); await enablementDelete('editor', 403); const apiResponse = await enablementPut('editor'); @@ -192,6 +192,19 @@ export default function ({ getService }: FtrProviderContext) { isValidApiKey: true, }); }); + + it('viewer user cannot delete API key', async () => { + await enablementPut(); + await enablementDelete('viewer', 403); + const apiResponse = await enablementPut('viewer'); + expect(apiResponse.body).eql({ + areApiKeysEnabled: true, + canManageApiKeys: false, + canEnable: false, + isEnabled: true, + isValidApiKey: true, + }); + }); }); }); }