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 tests #199562

Merged
merged 5 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
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 @@ -750,6 +750,9 @@ function getPatternFiringAutoRecoverFalseRuleType() {
} else if (scheduleByPattern === 'timeout') {
// delay longer than the timeout
await new Promise((r) => setTimeout(r, 12000));
} else if (scheduleByPattern === 'run_long') {
// delay so rule runs a little longer
await new Promise((r) => setTimeout(r, 4000));
} else {
services.alertFactory.create(instanceId).scheduleActions('default', scheduleByPattern);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export default function findBackfillTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const supertestWithoutAuth = getService('supertestWithoutAuth');

// Failing: See https://github.com/elastic/kibana/issues/196226
describe.skip('find backfill', () => {
describe('find backfill', () => {
let backfillIds: Array<{ id: string; spaceId: string }> = [];
const objectRemover = new ObjectRemover(supertest);
const start1 = moment().utc().startOf('day').subtract(14, 'days').toISOString();
Expand Down Expand Up @@ -279,15 +278,12 @@ export default function findBackfillTests({ getService }: FtrProviderContext) {
.auth(apiOptions.username, apiOptions.password);

// find backfill with end time that is after one backfill ends
const findEnd = moment(end2).utc().add(1, 'hour').toISOString();
const findWithEndOneRuleResponse = await supertestWithoutAuth
.post(
`${getUrlPrefix(
apiOptions.spaceId
)}/internal/alerting/rules/backfill/_find?end=${moment()
.utc()
.startOf('day')
.subtract(9, 'days')
.toISOString()}`
)}/internal/alerting/rules/backfill/_find?end=${findEnd}`
)
.set('kbn-xsrf', 'foo')
.auth(apiOptions.username, apiOptions.password);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function scheduleBackfillTests({ getService }: FtrProviderContext
rule_type_id: 'test.patternFiringAutoRecoverFalse',
params: {
pattern: {
instance: [true, false, true],
instance: ['run_long', 'run_long', 'run_long'],
},
},
schedule: { interval: '12h' },
Expand All @@ -85,7 +85,7 @@ export default function scheduleBackfillTests({ getService }: FtrProviderContext
expect(result.rule.tags).to.eql(['foo']);
expect(result.rule.params).to.eql({
pattern: {
instance: [true, false, true],
instance: ['run_long', 'run_long', 'run_long'],
},
});
expect(result.rule.enabled).to.eql(true);
Expand All @@ -103,7 +103,7 @@ export default function scheduleBackfillTests({ getService }: FtrProviderContext
expect(result.rule.tags).to.eql(['foo']);
expect(result.rule.params).to.eql({
pattern: {
instance: [true, false, true],
instance: ['run_long', 'run_long', 'run_long'],
},
});
expect(result.rule.enabled).to.eql(true);
Expand Down