Skip to content

Commit

Permalink
[Synthetics] Unskip Synthetics Serverless Enablement API tests (#180199)
Browse files Browse the repository at this point in the history
## Summary

Fixes #180108.

Previously these tests failed against MKI. This should resolve the
problem as we're no longer trying to use `system_indices_superuser`,
which doesn't exist in MKI environments.
  • Loading branch information
justinkambic authored Apr 8, 2024
1 parent 0f2861d commit c51354f
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export default function ({ getService }: FtrProviderContext) {
};

describe('SyntheticsEnablement', function () {
// failsOnMKI, see https://github.com/elastic/kibana/issues/180108
this.tags(['failsOnMKI']);
const svlUserManager = getService('svlUserManager');
const svlCommonApi = getService('svlCommonApi');
const supertestWithoutAuth = getService('supertestWithoutAuth');
Expand Down Expand Up @@ -81,7 +79,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 () => {
Expand All @@ -91,7 +89,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({
Expand Down Expand Up @@ -166,21 +164,21 @@ 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();

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');
Expand All @@ -192,6 +190,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,
});
});
});
});
}

0 comments on commit c51354f

Please sign in to comment.