From f1059882616e34e4f932b3785855112f09cec854 Mon Sep 17 00:00:00 2001 From: Ersin Erdal Date: Thu, 30 Nov 2023 22:51:45 +0100 Subject: [PATCH] enhance functional test --- .../test_suites/task_manager/skip.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/x-pack/test/plugin_api_integration/test_suites/task_manager/skip.ts b/x-pack/test/plugin_api_integration/test_suites/task_manager/skip.ts index 00c0833746490..6c5f4239436a4 100644 --- a/x-pack/test/plugin_api_integration/test_suites/task_manager/skip.ts +++ b/x-pack/test/plugin_api_integration/test_suites/task_manager/skip.ts @@ -55,6 +55,7 @@ export default function ({ getService }: FtrProviderContext) { expect(task.numSkippedRuns).to.eql(2); }); + let newLastRun: string; await retry.try(async () => { const task = await currentTask(createdTask.id); expect(task.attempts).to.eql(0); @@ -63,6 +64,18 @@ export default function ({ getService }: FtrProviderContext) { expect(task.numSkippedRuns).to.eql(2); // keeps rescheduling after skips expect(new Date(task.runAt).getTime()).to.greaterThan(new Date(lastRunAt).getTime()); + newLastRun = task.runAt; + }); + + // should keep running the rule after 2 skips and 1 successful run + await retry.try(async () => { + const task = await currentTask(createdTask.id); + expect(task.attempts).to.eql(0); + expect(task.retryAt).to.eql(null); + // skip attempts remains as it is + expect(task.numSkippedRuns).to.eql(2); + // keeps rescheduling after skips + expect(new Date(task.runAt).getTime()).to.greaterThan(new Date(newLastRun).getTime()); }); });