Skip to content

Commit

Permalink
Fixing flaky disable test (#142687)
Browse files Browse the repository at this point in the history
* Unskipping test

* Adding retries

* Cleanup

* Cleanup
  • Loading branch information
ymao1 authored Oct 5, 2022
1 parent 57876a8 commit 34deabc
Showing 1 changed file with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export default function createDisableRuleTests({ getService }: FtrProviderContex
const retry = getService('retry');
const supertest = getService('supertest');

// Failing: See https://github.com/elastic/kibana/issues/141864
describe.skip('disable', () => {
describe('disable', () => {
const objectRemover = new ObjectRemover(supertestWithoutAuth);
const ruleUtils = new RuleUtils({ space: Spaces.space1, supertestWithoutAuth });

Expand All @@ -52,15 +51,17 @@ export default function createDisableRuleTests({ getService }: FtrProviderContex
await ruleUtils.disable(createdRule.id);

// task doc should still exist but be disabled
const taskRecord = await getScheduledTask(createdRule.scheduled_task_id);
expect(taskRecord.type).to.eql('task');
expect(taskRecord.task.taskType).to.eql('alerting:test.noop');
expect(JSON.parse(taskRecord.task.params)).to.eql({
alertId: createdRule.id,
spaceId: Spaces.space1.id,
consumer: 'alertsFixture',
await retry.try(async () => {
const taskRecord = await getScheduledTask(createdRule.scheduled_task_id);
expect(taskRecord.type).to.eql('task');
expect(taskRecord.task.taskType).to.eql('alerting:test.noop');
expect(JSON.parse(taskRecord.task.params)).to.eql({
alertId: createdRule.id,
spaceId: Spaces.space1.id,
consumer: 'alertsFixture',
});
expect(taskRecord.task.enabled).to.eql(false);
});
expect(taskRecord.task.enabled).to.eql(false);

// Ensure AAD isn't broken
await checkAAD({
Expand Down Expand Up @@ -196,15 +197,17 @@ export default function createDisableRuleTests({ getService }: FtrProviderContex
.expect(204);

// task doc should still exist but be disabled
const taskRecord = await getScheduledTask(createdRule.scheduled_task_id);
expect(taskRecord.type).to.eql('task');
expect(taskRecord.task.taskType).to.eql('alerting:test.noop');
expect(JSON.parse(taskRecord.task.params)).to.eql({
alertId: createdRule.id,
spaceId: Spaces.space1.id,
consumer: 'alertsFixture',
await retry.try(async () => {
const taskRecord = await getScheduledTask(createdRule.scheduled_task_id);
expect(taskRecord.type).to.eql('task');
expect(taskRecord.task.taskType).to.eql('alerting:test.noop');
expect(JSON.parse(taskRecord.task.params)).to.eql({
alertId: createdRule.id,
spaceId: Spaces.space1.id,
consumer: 'alertsFixture',
});
expect(taskRecord.task.enabled).to.eql(false);
});
expect(taskRecord.task.enabled).to.eql(false);

// Ensure AAD isn't broken
await checkAAD({
Expand Down

0 comments on commit 34deabc

Please sign in to comment.