From 770a8e9e7599e20cedd4a3850ed53cad8d55363d Mon Sep 17 00:00:00 2001 From: Alexandra Doak Date: Wed, 24 Aug 2022 15:53:37 -0400 Subject: [PATCH] Adding functional test --- .../spaces_only/tests/alerting/migrations.ts | 20 ++++++++++ .../functional/es_archives/alerts/data.json | 38 +++++++++++++++++++ .../es_archives/alerts/mappings.json | 3 ++ 3 files changed, 61 insertions(+) diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts index 0f2752c87ee59..9edb414e39c77 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/migrations.ts @@ -444,6 +444,26 @@ export default function createGetTests({ getService }: FtrProviderContext) { expect(response.body._source?.alert?.tags).to.eql(['test-tag-1', 'foo-tag']); }); + it('8.4.1 removes IsSnoozedUntil', async () => { + const searchResult = await es.search( + { + index: '.kibana', + body: { + query: { + term: { + _id: 'alert:4d973df0-23df-11ed-8ae4-e988ad0f6fa7', + }, + }, + }, + }, + { meta: true } + ); + + expect(searchResult.statusCode).to.equal(200); + const hit = searchResult.body.hits.hits[0]; + expect((hit!._source!.alert! as RawRule).isSnoozedUntil).to.be(undefined); + }); + it('8.5.0 removes runtime and field params from older ES Query rules', async () => { const response = await es.get<{ alert: { diff --git a/x-pack/test/functional/es_archives/alerts/data.json b/x-pack/test/functional/es_archives/alerts/data.json index 90a2c15777ff8..0129bb2f4729c 100644 --- a/x-pack/test/functional/es_archives/alerts/data.json +++ b/x-pack/test/functional/es_archives/alerts/data.json @@ -1194,3 +1194,41 @@ } } } + +{ + "type": "doc", + "value": { + "id": "alert:4d973df0-23df-11ed-8ae4-e988ad0f6fa7", + "index": ".kibana_1", + "source": { + "alert": { + "alertTypeId": "example.always-firing", + "apiKey": null, + "apiKeyOwner": null, + "consumer": "alerts", + "createdAt": "2022-08-24T19:02:30.889Z", + "createdBy": "elastic", + "enabled": false, + "muteAll": false, + "mutedInstanceIds": [], + "name": "remove snoozed", + "params": {}, + "schedule": { + "interval": "1m" + }, + "scheduledTaskId": null, + "tags": [], + "throttle": null, + "updatedBy": "elastic", + "isSnoozedUntil": "2022-08-24T19:05:49.817Z" + }, + "migrationVersion": { + "alert": "8.3.0" + }, + "references": [ + ], + "type": "alert", + "updated_at": "2022-08-24T19:05:50.159Z" + } + } +} diff --git a/x-pack/test/functional/es_archives/alerts/mappings.json b/x-pack/test/functional/es_archives/alerts/mappings.json index babc00babc838..0da2b51499517 100644 --- a/x-pack/test/functional/es_archives/alerts/mappings.json +++ b/x-pack/test/functional/es_archives/alerts/mappings.json @@ -172,6 +172,9 @@ }, "updatedBy": { "type": "keyword" + }, + "isSnoozedUntil": { + "type": "date" } } },