Fix sharing saved objects phase 2 CI (#89056)
This commit is contained in:
parent
d81ab83c16
commit
8263d47d37
|
@ -206,6 +206,20 @@ describe('DocumentMigrator', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('coerces the current Kibana version if it has a hyphen', () => {
|
||||
const validDefinition = {
|
||||
kibanaVersion: '3.2.0-SNAPSHOT',
|
||||
typeRegistry: createRegistry({
|
||||
name: 'foo',
|
||||
convertToMultiNamespaceTypeVersion: '3.2.0',
|
||||
namespaceType: 'multiple',
|
||||
}),
|
||||
minimumConvertVersion: '0.0.0',
|
||||
log: mockLogger,
|
||||
};
|
||||
expect(() => new DocumentMigrator(validDefinition)).not.toThrowError();
|
||||
});
|
||||
|
||||
it('validates convertToMultiNamespaceTypeVersion is not used on a patch version', () => {
|
||||
const invalidDefinition = {
|
||||
kibanaVersion: '3.2.3',
|
||||
|
|
|
@ -159,10 +159,11 @@ export class DocumentMigrator implements VersionedTransformer {
|
|||
*/
|
||||
constructor({
|
||||
typeRegistry,
|
||||
kibanaVersion,
|
||||
kibanaVersion: rawKibanaVersion,
|
||||
minimumConvertVersion = DEFAULT_MINIMUM_CONVERT_VERSION,
|
||||
log,
|
||||
}: DocumentMigratorOptions) {
|
||||
const kibanaVersion = rawKibanaVersion.split('-')[0]; // coerce a semver-like string (x.y.z-SNAPSHOT) or prerelease version (x.y.z-alpha) to a regular semver (x.y.z)
|
||||
validateMigrationDefinition(typeRegistry, kibanaVersion, minimumConvertVersion);
|
||||
|
||||
this.documentMigratorOptions = { typeRegistry, kibanaVersion, log };
|
||||
|
|
Loading…
Reference in a new issue