Skip to content

Commit

Permalink
Adding functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
doakalexi committed Aug 24, 2022
1 parent 3153840 commit 770a8e9
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<RawRule>(
{
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: {
Expand Down
38 changes: 38 additions & 0 deletions x-pack/test/functional/es_archives/alerts/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
3 changes: 3 additions & 0 deletions x-pack/test/functional/es_archives/alerts/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@
},
"updatedBy": {
"type": "keyword"
},
"isSnoozedUntil": {
"type": "date"
}
}
},
Expand Down

0 comments on commit 770a8e9

Please sign in to comment.