Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing flaky runSoon test #142652

Merged
merged 4 commits into from
Oct 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export default function createRunSoonTests({ getService }: FtrProviderContext) {
const es = getService('es');
const esArchiver = getService('esArchiver');

// Failing: See https://github.com/elastic/kibana/issues/142564
describe.skip('runSoon', () => {
describe('runSoon', () => {
const objectRemover = new ObjectRemover(supertest);

before(async () => {
Expand All @@ -36,7 +35,7 @@ export default function createRunSoonTests({ getService }: FtrProviderContext) {

it('should successfully run rule where scheduled task id is different than rule id', async () => {
await retry.try(async () => {
// Sometimes the rule may already be running. Try until it isn't
// Sometimes the rule may already be running, which returns a 200. Try until it isn't
const response = await supertest
.post(`${getUrlPrefix(``)}/internal/alerting/rule/${LOADED_RULE_ID}/_run_soon`)
.set('kbn-xsrf', 'foo');
Expand All @@ -53,10 +52,13 @@ export default function createRunSoonTests({ getService }: FtrProviderContext) {
expect(response.status).to.eql(200);
objectRemover.add('default', response.body.id, 'rule', 'alerting');

const runSoonResponse = await supertest
.post(`${getUrlPrefix(``)}/internal/alerting/rule/${response.body.id}/_run_soon`)
.set('kbn-xsrf', 'foo');
expect(runSoonResponse.status).to.eql(204);
await retry.try(async () => {
// Sometimes the rule may already be running, which returns a 200. Try until it isn't
const runSoonResponse = await supertest
.post(`${getUrlPrefix(``)}/internal/alerting/rule/${response.body.id}/_run_soon`)
.set('kbn-xsrf', 'foo');
expect(runSoonResponse.status).to.eql(204);
});
});

it('should return message when task does not exist for rule', async () => {
Expand Down