From ed9d827ca4a58080de7ad4d7303df5d4b4d0458a Mon Sep 17 00:00:00 2001 From: Mark Hopkin Date: Mon, 14 Oct 2024 16:44:55 +0100 Subject: [PATCH 1/3] [Entity Analytics] Allow task status to be "claiming" in disable/enable test --- .../init_and_status_apis.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts index 19a9bb85326fa..013856fb0b5ec 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts @@ -19,6 +19,10 @@ import { } from '../../utils'; import { FtrProviderContext } from '../../../../ftr_provider_context'; +const expectTaskIsNotRunning = (taskStatus: any) => { + expect(['idle', 'claiming']).contain(taskStatus); +}; + export default ({ getService }: FtrProviderContext) => { const es = getService('es'); const supertest = getService('supertest'); @@ -355,7 +359,7 @@ export default ({ getService }: FtrProviderContext) => { expect(status2.body.legacy_risk_engine_status).to.be('NOT_INSTALLED'); expect(status2.body.risk_engine_task_status?.runAt).to.be.a('string'); - expect(status2.body.risk_engine_task_status?.status).to.be('idle'); + expectTaskIsNotRunning(status2.body.risk_engine_task_status?.status); expect(status2.body.risk_engine_task_status?.startedAt).to.be(undefined); await riskEngineRoutes.disable(); @@ -373,7 +377,7 @@ export default ({ getService }: FtrProviderContext) => { expect(status4.body.legacy_risk_engine_status).to.be('NOT_INSTALLED'); expect(status4.body.risk_engine_task_status?.runAt).to.be.a('string'); - expect(status4.body.risk_engine_task_status?.status).to.be('idle'); + expectTaskIsNotRunning(status4.body.risk_engine_task_status?.status); expect(status4.body.risk_engine_task_status?.startedAt).to.be(undefined); }); @@ -394,7 +398,7 @@ export default ({ getService }: FtrProviderContext) => { expect(status2.body.legacy_risk_engine_status).to.be('NOT_INSTALLED'); expect(status2.body.risk_engine_task_status?.runAt).to.be.a('string'); - expect(status2.body.risk_engine_task_status?.status).to.be('idle'); + expectTaskIsNotRunning(status2.body.risk_engine_task_status?.status); expect(status2.body.risk_engine_task_status?.startedAt).to.be(undefined); }); }); From 48a33cda6125a776b996cc36a03262d40f05e32b Mon Sep 17 00:00:00 2001 From: Mark Hopkin Date: Mon, 14 Oct 2024 16:59:42 +0100 Subject: [PATCH 2/3] remove any --- .../trial_license_complete_tier/init_and_status_apis.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts index 013856fb0b5ec..02041a96571c1 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts @@ -19,7 +19,7 @@ import { } from '../../utils'; import { FtrProviderContext } from '../../../../ftr_provider_context'; -const expectTaskIsNotRunning = (taskStatus: any) => { +const expectTaskIsNotRunning = (taskStatus: string) => { expect(['idle', 'claiming']).contain(taskStatus); }; From 717f561dd862ba3ce3d410542513d70170f3c950 Mon Sep 17 00:00:00 2001 From: Mark Hopkin Date: Tue, 15 Oct 2024 17:25:31 +0100 Subject: [PATCH 3/3] make arg optional --- .../trial_license_complete_tier/init_and_status_apis.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts index 02041a96571c1..3224caa24d5e2 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/entity_analytics/risk_engine/trial_license_complete_tier/init_and_status_apis.ts @@ -19,7 +19,7 @@ import { } from '../../utils'; import { FtrProviderContext } from '../../../../ftr_provider_context'; -const expectTaskIsNotRunning = (taskStatus: string) => { +const expectTaskIsNotRunning = (taskStatus?: string) => { expect(['idle', 'claiming']).contain(taskStatus); };