Avoid validating saved object migrationVersion in tests where not needed (#35010)

* Avoid validating migrationVersion in tests where not needed

* Ensure migrationVersion is at least defined
This commit is contained in:
Mike Côté 2019-04-12 21:29:40 -04:00 committed by GitHub
parent e5cabda964
commit cd0db0d07c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 21 additions and 37 deletions

View file

@ -66,9 +66,7 @@ export default function ({ getService }) {
uiStateJSON: resp.body.saved_objects[0].attributes.uiStateJSON,
kibanaSavedObjectMeta: resp.body.saved_objects[0].attributes.kibanaSavedObjectMeta
},
migrationVersion: {
visualization: '7.1.0',
},
migrationVersion: resp.body.saved_objects[0].migrationVersion,
references: [{
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
@ -96,6 +94,7 @@ export default function ({ getService }) {
}
]
});
expect(resp.body.saved_objects[0].migrationVersion).to.be.ok();
})
));
});

View file

@ -47,9 +47,7 @@ export default function ({ getService }) {
expect(resp.body).to.eql({
id: resp.body.id,
type: 'visualization',
migrationVersion: {
visualization: '7.1.0'
},
migrationVersion: resp.body.migrationVersion,
updated_at: resp.body.updated_at,
version: 'WzgsMV0=',
attributes: {
@ -57,6 +55,7 @@ export default function ({ getService }) {
},
references: [],
});
expect(resp.body.migrationVersion).to.be.ok();
});
});
});
@ -89,9 +88,7 @@ export default function ({ getService }) {
expect(resp.body).to.eql({
id: resp.body.id,
type: 'visualization',
migrationVersion: {
visualization: '7.1.0'
},
migrationVersion: resp.body.migrationVersion,
updated_at: resp.body.updated_at,
version: 'WzAsMV0=',
attributes: {
@ -99,6 +96,7 @@ export default function ({ getService }) {
},
references: [],
});
expect(resp.body.migrationVersion).to.be.ok();
});
expect(await es.indices.exists({ index: '.kibana' }))

View file

@ -220,9 +220,7 @@ export default function ({ getService }) {
version: 1,
},
id: 'be3733a0-9efe-11e7-acb3-3dab96693fab',
migrationVersion: {
dashboard: '7.0.0',
},
migrationVersion: objects[0].migrationVersion,
references: [
{
id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab',
@ -234,6 +232,7 @@ export default function ({ getService }) {
updated_at: '2017-09-21T18:57:40.826Z',
version: objects[0].version,
}]);
expect(objects[0].migrationVersion).to.be.ok();
expect(() => JSON.parse(objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON)).not.to.throwError();
expect(() => JSON.parse(objects[0].attributes.optionsJSON)).not.to.throwError();
expect(() => JSON.parse(objects[0].attributes.panelsJSON)).not.to.throwError();
@ -273,9 +272,7 @@ export default function ({ getService }) {
version: 1,
},
id: 'be3733a0-9efe-11e7-acb3-3dab96693fab',
migrationVersion: {
dashboard: '7.0.0',
},
migrationVersion: objects[0].migrationVersion,
references: [
{
id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab',
@ -287,6 +284,7 @@ export default function ({ getService }) {
updated_at: '2017-09-21T18:57:40.826Z',
version: objects[0].version,
}]);
expect(objects[0].migrationVersion).to.be.ok();
expect(() => JSON.parse(objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON)).not.to.throwError();
expect(() => JSON.parse(objects[0].attributes.optionsJSON)).not.to.throwError();
expect(() => JSON.parse(objects[0].attributes.panelsJSON)).not.to.throwError();
@ -331,9 +329,7 @@ export default function ({ getService }) {
version: 1,
},
id: 'be3733a0-9efe-11e7-acb3-3dab96693fab',
migrationVersion: {
dashboard: '7.0.0',
},
migrationVersion: objects[0].migrationVersion,
references: [
{
id: 'dd7caf20-9efd-11e7-acb3-3dab96693fab',
@ -345,6 +341,7 @@ export default function ({ getService }) {
updated_at: '2017-09-21T18:57:40.826Z',
version: objects[0].version,
}]);
expect(objects[0].migrationVersion).to.be.ok();
expect(() => JSON.parse(objects[0].attributes.kibanaSavedObjectMeta.searchSourceJSON)).not.to.throwError();
expect(() => JSON.parse(objects[0].attributes.optionsJSON)).not.to.throwError();
expect(() => JSON.parse(objects[0].attributes.panelsJSON)).not.to.throwError();

View file

@ -46,9 +46,7 @@ export default function ({ getService }) {
attributes: {
'title': 'Count of requests'
},
migrationVersion: {
visualization: '7.1.0',
},
migrationVersion: resp.body.saved_objects[0].migrationVersion,
references: [
{
id: '91200a00-9efd-11e7-acb3-3dab96693fab',
@ -60,6 +58,7 @@ export default function ({ getService }) {
}
]
});
expect(resp.body.saved_objects[0].migrationVersion).to.be.ok();
})
));

View file

@ -39,9 +39,7 @@ export default function ({ getService }) {
type: 'visualization',
updated_at: '2017-09-21T18:51:23.794Z',
version: resp.body.version,
migrationVersion: {
visualization: '7.1.0',
},
migrationVersion: resp.body.migrationVersion,
attributes: {
title: 'Count of requests',
description: '',
@ -57,6 +55,7 @@ export default function ({ getService }) {
id: '91200a00-9efd-11e7-acb3-3dab96693fab',
}],
});
expect(resp.body.migrationVersion).to.be.ok();
})
));

View file

@ -89,9 +89,7 @@ export function bulkGetTestSuiteFactory(esArchiver: any, supertest: SuperTest<an
{
id: `${getIdPrefix(spaceId)}dd7caf20-9efd-11e7-acb3-3dab96693fab`,
type: 'visualization',
migrationVersion: {
visualization: '7.1.0',
},
migrationVersion: resp.body.saved_objects[0].migrationVersion,
updated_at: '2017-09-21T18:51:23.794Z',
version: resp.body.saved_objects[0].version,
attributes: {

View file

@ -58,9 +58,7 @@ export function createTestSuiteFactory(es: any, esArchiver: any, supertest: Supe
expect(resp.body).to.eql({
id: resp.body.id,
migrationVersion: {
visualization: '7.1.0',
},
migrationVersion: resp.body.migrationVersion,
type: spaceAwareType,
updated_at: resp.body.updated_at,
version: resp.body.version,

View file

@ -71,7 +71,7 @@ export function exportTestSuiteFactory(esArchiver: any, supertest: SuperTest<any
id: `${getIdPrefix(spaceId)}91200a00-9efd-11e7-acb3-3dab96693fab`,
},
],
migrationVersion: { visualization: '7.1.0' },
migrationVersion: response.migrationVersion,
updated_at: '2017-09-21T18:51:23.794Z',
});
};

View file

@ -99,9 +99,7 @@ export function findTestSuiteFactory(esArchiver: any, supertest: SuperTest<any>)
attributes: {
title: 'Count of requests',
},
migrationVersion: {
visualization: '7.1.0',
},
migrationVersion: resp.body.saved_objects[0].migrationVersion,
references: [
{
id: `${getIdPrefix(spaceId)}91200a00-9efd-11e7-acb3-3dab96693fab`,

View file

@ -95,9 +95,7 @@ export function getTestSuiteFactory(esArchiver: any, supertest: SuperTest<any>)
expect(resp.body).to.eql({
id: `${getIdPrefix(spaceId)}dd7caf20-9efd-11e7-acb3-3dab96693fab`,
type: 'visualization',
migrationVersion: {
visualization: '7.1.0',
},
migrationVersion: resp.body.migrationVersion,
updated_at: '2017-09-21T18:51:23.794Z',
version: resp.body.version,
attributes: {