From 2b6e5278527c6fecc54af24c5426b5308ee9ceb4 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 26 Sep 2022 16:06:23 +0100 Subject: [PATCH 1/5] [Archive Migrations] security_solution-timelines Add new kbn archive with an index pattern taken from the es archive. Change the test to use both es and kbn archives. Since all these objects are loaded into a space, just delete the space afterwards instead of unloading with es archiver. Helps with: #102552 --- scripts/archive_migration_functions.sh | 35 ++++++++++--- .../security_solution/timeline_migrations.ts | 49 +++++++++--------- .../timelines/7.15.0_space/data.json.gz | Bin 3247 -> 3011 bytes .../security_solution/timelines/7.15.0_space | 20 +++++++ 4 files changed, 74 insertions(+), 30 deletions(-) create mode 100644 x-pack/test/functional/fixtures/kbn_archiver/security_solution/timelines/7.15.0_space diff --git a/scripts/archive_migration_functions.sh b/scripts/archive_migration_functions.sh index 7dcba01175731..a1f002bab1ef2 100755 --- a/scripts/archive_migration_functions.sh +++ b/scripts/archive_migration_functions.sh @@ -1,13 +1,30 @@ -standard_list="url,index-pattern,query,graph-workspace,tag,visualization,canvas-element,canvas-workpad,dashboard,search,lens,map,cases,uptime-dynamic-settings,osquery-saved-query,osquery-pack,infrastructure-ui-source,metrics-explorer-view,inventory-view,infrastructure-monitoring-log-view,apm-indices" +#!/bin/bash + +# ??? Should we migrate +# x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space +# ### Yes, it needs migration +# ### Saved Object type(s) that we care about: +# index-pattern +# ### Test file(s) that use it: +# x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts +# ### Config(s) that govern the test file(s): +# x-pack/test/api_integration/config.ts +# The other types it contains: +# config +# index-pattern +# siem-ui-timeline +# siem-ui-timeline-note +# siem-ui-timeline-pinned-event +# space -orig_archive="x-pack/test/functional/es_archives/banners/multispace" -new_archive="x-pack/test/functional/fixtures/kbn_archiver/banners/multi_space" +standard_list="url,index-pattern,query,graph-workspace,tag,visualization,canvas-element,canvas-workpad,dashboard,search,lens,map,cases,uptime-dynamic-settings,osquery-saved-query,osquery-pack,infrastructure-ui-source,metrics-explorer-view,inventory-view,infrastructure-monitoring-log-view,apm-indices" -# newArchives=("x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space") +orig_archive="x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space" +new_archive="x-pack/test/functional/fixtures/kbn_archiver/security_solution/timelines/7.15.0_space" -# testFiles=("x-pack/test/functional/apps/discover/preserve_url.ts") +testFiles=("x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts") -test_config="x-pack/test/banners_functional/config.ts" +test_config="x-pack/test/api_integration/config.ts" list_stragglers() { @@ -366,6 +383,12 @@ save_kbn() { # node scripts/kbn_archiver.js --config x-pack/test/spaces_api_integration/security_and_spaces/config_basic.ts save x-pack/test/functional/fixtures/kbn_archiver/saved_objects/default_space --type search,index-pattern,visualization,dashboard,lens,map,graph-workspace,query,tag,url,canvas-workpad } +load_my_kbn() { + set -x + node scripts/kbn_archiver.js --config "$test_config" load my-es-archive.json + set +x +} + load_kbn() { local space=${1:-default} local archive=${2:-${new_archive}} diff --git a/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts b/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts index 47c6e28d9bab7..e54f7d2934ebb 100644 --- a/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts +++ b/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts @@ -11,12 +11,12 @@ import { pinnedEventSavedObjectType, timelineSavedObjectType, } from '@kbn/security-solution-plugin/server/lib/timeline/saved_object_mappings'; -import { TimelineWithoutExternalRefs } from '@kbn/security-solution-plugin/common/types/timeline'; -import { NoteWithoutExternalRefs } from '@kbn/security-solution-plugin/common/types/timeline/note'; +import {TimelineWithoutExternalRefs} from '@kbn/security-solution-plugin/common/types/timeline'; +import {NoteWithoutExternalRefs} from '@kbn/security-solution-plugin/common/types/timeline/note'; -import { PinnedEventWithoutExternalRefs } from '@kbn/security-solution-plugin/common/types/timeline/pinned_event'; -import { FtrProviderContext } from '../../ftr_provider_context'; -import { getSavedObjectFromES } from './utils'; +import {PinnedEventWithoutExternalRefs} from '@kbn/security-solution-plugin/common/types/timeline/pinned_event'; +import {FtrProviderContext} from '../../ftr_provider_context'; +import {getSavedObjectFromES} from './utils'; interface TimelineWithoutSavedQueryId { [timelineSavedObjectType]: TimelineWithoutExternalRefs; @@ -30,12 +30,14 @@ interface PinnedEventWithoutTimelineId { [pinnedEventSavedObjectType]: PinnedEventWithoutExternalRefs; } -export default function ({ getService }: FtrProviderContext) { +export default function ({getService}: FtrProviderContext) { const supertest = getService('supertest'); - describe('Timeline migrations', () => { + describe.only('Timeline migrations', () => { const esArchiver = getService('esArchiver'); const es = getService('es'); + const kibanaServer = getService('kibanaServer'); + const spacesService = getService('spaces'); describe('8.0 id migration', () => { const resolveWithSpaceApi = '/s/awesome-space/api/timeline/resolve'; @@ -44,19 +46,18 @@ export default function ({ getService }: FtrProviderContext) { await esArchiver.load( 'x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space' ); - }); - - after(async () => { - await esArchiver.unload( - 'x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space' + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/security_solution/timelines/7.15.0_space', {space: 'awesome-space'} ); }); + after(async () => await spacesService.delete('awesome-space')); + describe('resolve', () => { it('should return an aliasMatch outcome', async () => { const resp = await supertest .get(resolveWithSpaceApi) - .query({ id: '1e2e9850-25f8-11ec-a981-b77847c6ef30' }); + .query({id: '1e2e9850-25f8-11ec-a981-b77847c6ef30'}); expect(resp.body.data.outcome).to.be('aliasMatch'); expect(resp.body.data.alias_target_id).to.not.be(undefined); @@ -67,7 +68,7 @@ export default function ({ getService }: FtrProviderContext) { it('should return the notes with the correct eventId', async () => { const resp = await supertest .get(resolveWithSpaceApi) - .query({ id: '1e2e9850-25f8-11ec-a981-b77847c6ef30' }); + .query({id: '1e2e9850-25f8-11ec-a981-b77847c6ef30'}); expect(resp.body.data.timeline.notes[0].eventId).to.be('StU_UXwBAowmaxx6YdiS'); }); @@ -75,7 +76,7 @@ export default function ({ getService }: FtrProviderContext) { it('should return notes with the timelineId matching the resolved timeline id', async () => { const resp = await supertest .get(resolveWithSpaceApi) - .query({ id: '1e2e9850-25f8-11ec-a981-b77847c6ef30' }); + .query({id: '1e2e9850-25f8-11ec-a981-b77847c6ef30'}); expect(resp.body.data.timeline.notes[0].timelineId).to.be( resp.body.data.timeline.savedObjectId @@ -90,7 +91,7 @@ export default function ({ getService }: FtrProviderContext) { it('should pinned events with eventId', async () => { const resp = await supertest .get(resolveWithSpaceApi) - .query({ id: '1e2e9850-25f8-11ec-a981-b77847c6ef30' }); + .query({id: '1e2e9850-25f8-11ec-a981-b77847c6ef30'}); expect(resp.body.data.timeline.pinnedEventsSaveObject[0].eventId).to.be( 'StU_UXwBAowmaxx6YdiS' @@ -100,7 +101,7 @@ export default function ({ getService }: FtrProviderContext) { it('should return pinned events with the timelineId matching request id', async () => { const resp = await supertest .get(resolveWithSpaceApi) - .query({ id: '1e2e9850-25f8-11ec-a981-b77847c6ef30' }); + .query({id: '1e2e9850-25f8-11ec-a981-b77847c6ef30'}); expect(resp.body.data.timeline.pinnedEventsSaveObject[0].timelineId).to.be( resp.body.data.timeline.savedObjectId @@ -149,7 +150,7 @@ export default function ({ getService }: FtrProviderContext) { it('preserves the eventId in the saved object after migration', async () => { const resp = await supertest .get('/api/timeline') - .query({ id: '6484cc90-126e-11ec-83d2-db1096c73738' }); + .query({id: '6484cc90-126e-11ec-83d2-db1096c73738'}); expect(resp.body.data.getOneTimeline.notes[0].eventId).to.be('Edo00XsBEVtyvU-8LGNe'); }); @@ -157,7 +158,7 @@ export default function ({ getService }: FtrProviderContext) { it('returns the timelineId in the response', async () => { const resp = await supertest .get('/api/timeline') - .query({ id: '6484cc90-126e-11ec-83d2-db1096c73738' }); + .query({id: '6484cc90-126e-11ec-83d2-db1096c73738'}); expect(resp.body.data.getOneTimeline.notes[0].timelineId).to.be( '6484cc90-126e-11ec-83d2-db1096c73738' @@ -174,7 +175,7 @@ export default function ({ getService }: FtrProviderContext) { es, timelineSavedObjectType, { - ids: { values: ['siem-ui-timeline:8dc70950-1012-11ec-9ad3-2d7c6600c0f7'] }, + ids: {values: ['siem-ui-timeline:8dc70950-1012-11ec-9ad3-2d7c6600c0f7']}, } ); @@ -186,7 +187,7 @@ export default function ({ getService }: FtrProviderContext) { it('preserves the title in the saved object after migration', async () => { const resp = await supertest .get('/api/timeline') - .query({ id: '8dc70950-1012-11ec-9ad3-2d7c6600c0f7' }); + .query({id: '8dc70950-1012-11ec-9ad3-2d7c6600c0f7'}); expect(resp.body.data.getOneTimeline.title).to.be('Awesome Timeline'); }); @@ -194,7 +195,7 @@ export default function ({ getService }: FtrProviderContext) { it('returns the savedQueryId in the response', async () => { const resp = await supertest .get('/api/timeline') - .query({ id: '8dc70950-1012-11ec-9ad3-2d7c6600c0f7' }); + .query({id: '8dc70950-1012-11ec-9ad3-2d7c6600c0f7'}); expect(resp.body.data.getOneTimeline.savedQueryId).to.be("It's me"); }); @@ -226,7 +227,7 @@ export default function ({ getService }: FtrProviderContext) { it('preserves the eventId in the saved object after migration', async () => { const resp = await supertest .get('/api/timeline') - .query({ id: '6484cc90-126e-11ec-83d2-db1096c73738' }); + .query({id: '6484cc90-126e-11ec-83d2-db1096c73738'}); expect(resp.body.data.getOneTimeline.pinnedEventsSaveObject[0].eventId).to.be( 'DNo00XsBEVtyvU-8LGNe' @@ -239,7 +240,7 @@ export default function ({ getService }: FtrProviderContext) { it('returns the timelineId in the response', async () => { const resp = await supertest .get('/api/timeline') - .query({ id: '6484cc90-126e-11ec-83d2-db1096c73738' }); + .query({id: '6484cc90-126e-11ec-83d2-db1096c73738'}); expect(resp.body.data.getOneTimeline.pinnedEventsSaveObject[0].timelineId).to.be( '6484cc90-126e-11ec-83d2-db1096c73738' diff --git a/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space/data.json.gz b/x-pack/test/functional/es_archives/security_solution/timelines/7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dpYGS7mt@msQnVgV(PIcAIAQ1<}Z}md!wEFcf58Mu^3* z^}U5-dSH2aU?u(8n=Ak;(*?^G{F71#s-hr%=^Y6`CwgfR-a!Cc%^%dT%Qm zOdVVZ7n!g3b@K=Hv%wDY2bQ+`{DFzoWB%ZHk$*of@*lGuuPfVez*o7BNtEM7_|>_Y zLvojgl=9g!On$md(gELSKHvn^-k^9xd9OqAcCR3v_6qjOtzY=Aj=p?eo%}P~5{IAs zql&?P91UWf8ca0KZ?~DuOuq}Q*D3!H%NipA6%u}( zE*_PkX?EX|-t&A6bqvFFB?OTv$xxMC30lOpAtffE$kjF7v7eNWDFeFae-t6MCts?wX#80{{v0<-(YwIp>MV&c0%ay`U?S6rj~j9%RHMU^q+RhecCA45Mn%` z+wG*0tlmLiIX%3iv&L4td59#o+D#*7-D+PCC(y?qr%a?sNLhBAG7!>br0V*52dXE< zMEZrKj5OwOt)XRED`O(l(;!L6ILRm3~2${Qua;8}*G&_=YOSN_BRYAHs!BxPwSBofs{A>M4lm hB=vDr_||QrvpLM&dQw#%>gGD0^#89V>XLAH002`|HD~|; diff --git a/x-pack/test/functional/fixtures/kbn_archiver/security_solution/timelines/7.15.0_space b/x-pack/test/functional/fixtures/kbn_archiver/security_solution/timelines/7.15.0_space new file mode 100644 index 0000000000000..53acfb24cb301 --- /dev/null +++ b/x-pack/test/functional/fixtures/kbn_archiver/security_solution/timelines/7.15.0_space @@ -0,0 +1,20 @@ +{ + "attributes": { + "fieldAttrs": "{}", + "fields": "[]", + "runtimeFieldMap": "{}", + "timeFieldName": "", + "title": ".kibana_7.15.0", + "typeMeta": "{}" + }, + "coreMigrationVersion": "8.6.0", + "id": "cf0a7895-d367-5eff-9d71-8d6b58b0b5d9", + "migrationVersion": { + "index-pattern": "8.0.0" + }, + "originId": "4f57d680-25f3-11ec-a981-b77847c6ef30", + "references": [], + "type": "index-pattern", + "updated_at": "2021-10-05T15:45:48.019Z", + "version": "WzIyLDJd" +} \ No newline at end of file From 332f8b120ce703bca7ab988d8e6371d6e02d39f7 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 30 Sep 2022 16:40:24 +0100 Subject: [PATCH 2/5] Drop exclusive --- .../apis/security_solution/timeline_migrations.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts b/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts index e54f7d2934ebb..ce52195fcc296 100644 --- a/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts +++ b/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts @@ -33,7 +33,7 @@ interface PinnedEventWithoutTimelineId { export default function ({getService}: FtrProviderContext) { const supertest = getService('supertest'); - describe.only('Timeline migrations', () => { + describe('Timeline migrations', () => { const esArchiver = getService('esArchiver'); const es = getService('es'); const kibanaServer = getService('kibanaServer'); From dab78a4a80ff0ab7c001d4dc3df80b29ba591b6f Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 13 Oct 2022 16:51:34 +0100 Subject: [PATCH 3/5] Drop unneeded fn. --- scripts/archive_migration_functions.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scripts/archive_migration_functions.sh b/scripts/archive_migration_functions.sh index a1f002bab1ef2..36c7f61abdba1 100755 --- a/scripts/archive_migration_functions.sh +++ b/scripts/archive_migration_functions.sh @@ -383,12 +383,6 @@ save_kbn() { # node scripts/kbn_archiver.js --config x-pack/test/spaces_api_integration/security_and_spaces/config_basic.ts save x-pack/test/functional/fixtures/kbn_archiver/saved_objects/default_space --type search,index-pattern,visualization,dashboard,lens,map,graph-workspace,query,tag,url,canvas-workpad } -load_my_kbn() { - set -x - node scripts/kbn_archiver.js --config "$test_config" load my-es-archive.json - set +x -} - load_kbn() { local space=${1:-default} local archive=${2:-${new_archive}} From 3b69c2b5657aeff89b422506ebbcc222e9e09d85 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Thu, 13 Oct 2022 16:55:18 +0100 Subject: [PATCH 4/5] Lint in my pocket. --- .../security_solution/timeline_migrations.ts | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts b/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts index ce52195fcc296..fe47677040d73 100644 --- a/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts +++ b/x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts @@ -11,12 +11,12 @@ import { pinnedEventSavedObjectType, timelineSavedObjectType, } from '@kbn/security-solution-plugin/server/lib/timeline/saved_object_mappings'; -import {TimelineWithoutExternalRefs} from '@kbn/security-solution-plugin/common/types/timeline'; -import {NoteWithoutExternalRefs} from '@kbn/security-solution-plugin/common/types/timeline/note'; +import { TimelineWithoutExternalRefs } from '@kbn/security-solution-plugin/common/types/timeline'; +import { NoteWithoutExternalRefs } from '@kbn/security-solution-plugin/common/types/timeline/note'; -import {PinnedEventWithoutExternalRefs} from '@kbn/security-solution-plugin/common/types/timeline/pinned_event'; -import {FtrProviderContext} from '../../ftr_provider_context'; -import {getSavedObjectFromES} from './utils'; +import { PinnedEventWithoutExternalRefs } from '@kbn/security-solution-plugin/common/types/timeline/pinned_event'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { getSavedObjectFromES } from './utils'; interface TimelineWithoutSavedQueryId { [timelineSavedObjectType]: TimelineWithoutExternalRefs; @@ -30,7 +30,7 @@ interface PinnedEventWithoutTimelineId { [pinnedEventSavedObjectType]: PinnedEventWithoutExternalRefs; } -export default function ({getService}: FtrProviderContext) { +export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); describe('Timeline migrations', () => { @@ -47,7 +47,8 @@ export default function ({getService}: FtrProviderContext) { 'x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space' ); await kibanaServer.importExport.load( - 'x-pack/test/functional/fixtures/kbn_archiver/security_solution/timelines/7.15.0_space', {space: 'awesome-space'} + 'x-pack/test/functional/fixtures/kbn_archiver/security_solution/timelines/7.15.0_space', + { space: 'awesome-space' } ); }); @@ -57,7 +58,7 @@ export default function ({getService}: FtrProviderContext) { it('should return an aliasMatch outcome', async () => { const resp = await supertest .get(resolveWithSpaceApi) - .query({id: '1e2e9850-25f8-11ec-a981-b77847c6ef30'}); + .query({ id: '1e2e9850-25f8-11ec-a981-b77847c6ef30' }); expect(resp.body.data.outcome).to.be('aliasMatch'); expect(resp.body.data.alias_target_id).to.not.be(undefined); @@ -68,7 +69,7 @@ export default function ({getService}: FtrProviderContext) { it('should return the notes with the correct eventId', async () => { const resp = await supertest .get(resolveWithSpaceApi) - .query({id: '1e2e9850-25f8-11ec-a981-b77847c6ef30'}); + .query({ id: '1e2e9850-25f8-11ec-a981-b77847c6ef30' }); expect(resp.body.data.timeline.notes[0].eventId).to.be('StU_UXwBAowmaxx6YdiS'); }); @@ -76,7 +77,7 @@ export default function ({getService}: FtrProviderContext) { it('should return notes with the timelineId matching the resolved timeline id', async () => { const resp = await supertest .get(resolveWithSpaceApi) - .query({id: '1e2e9850-25f8-11ec-a981-b77847c6ef30'}); + .query({ id: '1e2e9850-25f8-11ec-a981-b77847c6ef30' }); expect(resp.body.data.timeline.notes[0].timelineId).to.be( resp.body.data.timeline.savedObjectId @@ -91,7 +92,7 @@ export default function ({getService}: FtrProviderContext) { it('should pinned events with eventId', async () => { const resp = await supertest .get(resolveWithSpaceApi) - .query({id: '1e2e9850-25f8-11ec-a981-b77847c6ef30'}); + .query({ id: '1e2e9850-25f8-11ec-a981-b77847c6ef30' }); expect(resp.body.data.timeline.pinnedEventsSaveObject[0].eventId).to.be( 'StU_UXwBAowmaxx6YdiS' @@ -101,7 +102,7 @@ export default function ({getService}: FtrProviderContext) { it('should return pinned events with the timelineId matching request id', async () => { const resp = await supertest .get(resolveWithSpaceApi) - .query({id: '1e2e9850-25f8-11ec-a981-b77847c6ef30'}); + .query({ id: '1e2e9850-25f8-11ec-a981-b77847c6ef30' }); expect(resp.body.data.timeline.pinnedEventsSaveObject[0].timelineId).to.be( resp.body.data.timeline.savedObjectId @@ -150,7 +151,7 @@ export default function ({getService}: FtrProviderContext) { it('preserves the eventId in the saved object after migration', async () => { const resp = await supertest .get('/api/timeline') - .query({id: '6484cc90-126e-11ec-83d2-db1096c73738'}); + .query({ id: '6484cc90-126e-11ec-83d2-db1096c73738' }); expect(resp.body.data.getOneTimeline.notes[0].eventId).to.be('Edo00XsBEVtyvU-8LGNe'); }); @@ -158,7 +159,7 @@ export default function ({getService}: FtrProviderContext) { it('returns the timelineId in the response', async () => { const resp = await supertest .get('/api/timeline') - .query({id: '6484cc90-126e-11ec-83d2-db1096c73738'}); + .query({ id: '6484cc90-126e-11ec-83d2-db1096c73738' }); expect(resp.body.data.getOneTimeline.notes[0].timelineId).to.be( '6484cc90-126e-11ec-83d2-db1096c73738' @@ -175,7 +176,7 @@ export default function ({getService}: FtrProviderContext) { es, timelineSavedObjectType, { - ids: {values: ['siem-ui-timeline:8dc70950-1012-11ec-9ad3-2d7c6600c0f7']}, + ids: { values: ['siem-ui-timeline:8dc70950-1012-11ec-9ad3-2d7c6600c0f7'] }, } ); @@ -187,7 +188,7 @@ export default function ({getService}: FtrProviderContext) { it('preserves the title in the saved object after migration', async () => { const resp = await supertest .get('/api/timeline') - .query({id: '8dc70950-1012-11ec-9ad3-2d7c6600c0f7'}); + .query({ id: '8dc70950-1012-11ec-9ad3-2d7c6600c0f7' }); expect(resp.body.data.getOneTimeline.title).to.be('Awesome Timeline'); }); @@ -195,7 +196,7 @@ export default function ({getService}: FtrProviderContext) { it('returns the savedQueryId in the response', async () => { const resp = await supertest .get('/api/timeline') - .query({id: '8dc70950-1012-11ec-9ad3-2d7c6600c0f7'}); + .query({ id: '8dc70950-1012-11ec-9ad3-2d7c6600c0f7' }); expect(resp.body.data.getOneTimeline.savedQueryId).to.be("It's me"); }); @@ -227,7 +228,7 @@ export default function ({getService}: FtrProviderContext) { it('preserves the eventId in the saved object after migration', async () => { const resp = await supertest .get('/api/timeline') - .query({id: '6484cc90-126e-11ec-83d2-db1096c73738'}); + .query({ id: '6484cc90-126e-11ec-83d2-db1096c73738' }); expect(resp.body.data.getOneTimeline.pinnedEventsSaveObject[0].eventId).to.be( 'DNo00XsBEVtyvU-8LGNe' @@ -240,7 +241,7 @@ export default function ({getService}: FtrProviderContext) { it('returns the timelineId in the response', async () => { const resp = await supertest .get('/api/timeline') - .query({id: '6484cc90-126e-11ec-83d2-db1096c73738'}); + .query({ id: '6484cc90-126e-11ec-83d2-db1096c73738' }); expect(resp.body.data.getOneTimeline.pinnedEventsSaveObject[0].timelineId).to.be( '6484cc90-126e-11ec-83d2-db1096c73738' From d7c854dbdbde956ab28bb91843d366b89c413ff4 Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Fri, 14 Oct 2022 14:29:03 +0100 Subject: [PATCH 5/5] Thanks to J. Buttner, "re-drop" non needed objects from the original archive. --- .../timelines/7.15.0_space/data.json.gz | Bin 3011 -> 2832 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space/data.json.gz b/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space/data.json.gz index 303b11cac0ef0d3b4dc9420fcd69c6a889eb2925..863d72c8f64d17bd6bcb4269b9dead1f2d065ebc 100644 GIT binary patch delta 2816 zcmV+b3;*=P7myZzABzY8000000u$|ATXWmE6@K@x;P9#4F%*J#>Z#dw+xj8fG;wy? zMj0CE|Y2pAlHyj*%2hzitB+1$RjLAburm-iV z^A|TH%=w!K_yhh7C~qaVERClOr8DBOVH&V0$^(=IQx*n)5gTF^V^`M{q#C}BFlHVi zj*XFPS+;I@Ci68#jLrv)D7)ih4!#F2iO3bMTGBXAyr-$*jTa~ELoiNA7R1qSEJ@)P z?`jROF{nlax`<4fU~PfdCz^!$EMbwyQXu+TzWp|DZp&0-LogEN)2QB)|9hxC&x!uY z2xZA-sn#fe&X6C38B9&*yp;5XYX8D#Ofxc_Ewpn@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