Skip to content

Commit 8f70f1b

Browse files
authored
Fixing flaky test (#144735)
1 parent 8df879c commit 8f70f1b

File tree

1 file changed

+4
-3
lines changed
  • x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query

1 file changed

+4
-3
lines changed

x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/rule.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ export default function ruleTests({ getService }: FtrProviderContext) {
3737
createEsDocumentsInGroups,
3838
} = getRuleServices(getService);
3939

40-
// Failing: See https://github.com/elastic/kibana/issues/143870
41-
describe.skip('rule', async () => {
40+
describe('rule', async () => {
4241
let endDate: string;
4342
let connectorId: string;
4443
const objectRemover = new ObjectRemover(supertest);
@@ -221,6 +220,8 @@ export default function ruleTests({ getService }: FtrProviderContext) {
221220
].forEach(([searchType, initData]) =>
222221
it(`runs correctly: use epoch millis - threshold on hit count < > for ${searchType} search type`, async () => {
223222
// write documents from now to the future end date in groups
223+
const endDateMillis = Date.now() + (RULE_INTERVALS_TO_WRITE - 1) * RULE_INTERVAL_MILLIS;
224+
endDate = new Date(endDateMillis).toISOString();
224225
await createEsDocumentsInGroups(ES_GROUPS_TO_WRITE, endDate);
225226
await initData();
226227

@@ -239,7 +240,7 @@ export default function ruleTests({ getService }: FtrProviderContext) {
239240

240241
// during the first execution, the latestTimestamp value should be empty
241242
// since this rule always fires, the latestTimestamp value should be updated each execution
242-
if (!i) {
243+
if (i === 0) {
243244
expect(previousTimestamp).to.be.empty();
244245
} else {
245246
expect(previousTimestamp).not.to.be.empty();

0 commit comments

Comments
 (0)