Skip to content

Commit

Permalink
Attempt to harden calls to Case API
Browse files Browse the repository at this point in the history
  • Loading branch information
CoenWarmer committed May 1, 2023
1 parent a127521 commit 4df29a3
Showing 1 changed file with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const observability = getService('observability');
const find = getService('find');
const PageObjects = getPageObjects(['common', 'header']);
const retry = getService('retry');

describe('Observability cases', () => {
before(async () => {
Expand All @@ -38,25 +39,29 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
);

const owner = 'observability';
const caseData = await cases.api.createCase({
title: 'Sample case',
owner,
});
await cases.api.createAttachment({
caseId: caseData.id,
params: {
alertId: ['alert-id'],
index: ['.internal.alerts-observability.alerts-default-000001'],
rule: { id: 'rule-id', name: 'My rule name' },
type: CommentType.alert,
await retry.try(async () => {
const caseData = await cases.api.createCase({
title: 'Sample case',
owner,
},
});
await cases.api.createAttachment({
caseId: caseData.id,
params: {
alertId: ['alert-id'],
index: ['.internal.alerts-observability.alerts-default-000001'],
rule: { id: 'rule-id', name: 'My rule name' },
type: CommentType.alert,
owner,
},
});
});
});

after(async () => {
await cases.api.deleteAllCases();
await observability.users.restoreDefaultTestUserRole();
await retry.try(async () => {
await cases.api.deleteAllCases();
await observability.users.restoreDefaultTestUserRole();
});
});

it('should link to observability rule pages in case details', async () => {
Expand Down

0 comments on commit 4df29a3

Please sign in to comment.