Skip to content

Commit

Permalink
Fixing flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
ymao1 committed Nov 1, 2024
1 parent 413f7c1 commit f0e94ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import expect from '@kbn/expect';
import expect from '@kbn/expect/expect';
import moment from 'moment';
import { asyncForEach } from '@kbn/std';
import { UserAtSpaceScenarios } from '../../../../scenarios';
Expand All @@ -16,6 +16,7 @@ import { FtrProviderContext } from '../../../../../common/ftr_provider_context';
export default function findBackfillTests({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const supertestWithoutAuth = getService('supertestWithoutAuth');
const log = getService('log');

describe('find backfill', () => {
let backfillIds: Array<{ id: string; spaceId: string }> = [];
Expand All @@ -25,6 +26,7 @@ export default function findBackfillTests({ getService }: FtrProviderContext) {
const start2 = moment().utc().startOf('day').subtract(12, 'days').toISOString();
const end2 = moment().utc().startOf('day').subtract(10, 'day').toISOString();

log.info(`start1: ${start1}, end1: ${end1}, start2: ${start2}, end2: ${end2}`);
afterEach(async () => {
await asyncForEach(backfillIds, async ({ id, spaceId }: { id: string; spaceId: string }) => {
await supertest
Expand Down Expand Up @@ -169,6 +171,7 @@ export default function findBackfillTests({ getService }: FtrProviderContext) {
]);

const scheduleResult = scheduleResponse.body;
log.info(`scheduleResult: ${JSON.stringify(scheduleResult)}`);
expect(scheduleResult.length).to.eql(2);
const backfillId1 = scheduleResult[0].id;
const backfillId2 = scheduleResult[1].id;
Expand Down Expand Up @@ -548,6 +551,11 @@ export default function findBackfillTests({ getService }: FtrProviderContext) {

const resultFindWithEndOneRuleResponse = findWithEndOneRuleResponse.body;
expect(resultFindWithEndOneRuleResponse.page).to.eql(1);
log.info(
`resultFindWithEndOneRuleResponse ${JSON.stringify(
resultFindWithEndOneRuleResponse
)}`
);
expect(resultFindWithEndOneRuleResponse.per_page).to.eql(10);
expect(resultFindWithEndOneRuleResponse.total).to.eql(1);
expect(resultFindWithEndOneRuleResponse.data.length).to.eql(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ export default function createBackfillTaskRunnerTests({ getService }: FtrProvide
moment().utc().startOf('day').subtract(9, 'days').add(41, 'minutes').toISOString(),
];

// FLAKY: https://github.com/elastic/kibana/issues/192144
describe.skip('ad hoc backfill task', () => {
describe('ad hoc backfill task', () => {
beforeEach(async () => {
await esTestIndexTool.destroy();
await esTestIndexTool.setup();
Expand Down Expand Up @@ -167,7 +166,7 @@ export default function createBackfillTaskRunnerTests({ getService }: FtrProvide
objectRemover.add(spaceId, ruleId, 'rule', 'alerting');

const start = moment(originalDocTimestamps[1]).utc().startOf('day').toISOString();
const end = moment().utc().startOf('day').subtract(9, 'days').toISOString();
const end = moment(originalDocTimestamps[11]).utc().startOf('day').toISOString();

// Schedule backfill for this rule
const response2 = await supertestWithoutAuth
Expand Down

0 comments on commit f0e94ce

Please sign in to comment.