mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 2fab2041c4
)
Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
This commit is contained in:
parent
0f61496666
commit
391d999075
2 changed files with 27 additions and 1 deletions
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { checkKibanaVersion } from './upgrade_handler';
|
||||
|
||||
describe('upgrade handler', () => {
|
||||
describe('checkKibanaVersion', () => {
|
||||
it('should not throw if upgrade version is equal to kibana version', () => {
|
||||
expect(() => checkKibanaVersion('8.4.0', '8.4.0')).not.toThrowError();
|
||||
});
|
||||
|
||||
it('should throw if upgrade version is higher than kibana version', () => {
|
||||
expect(() => checkKibanaVersion('8.5.0', '8.4.0')).toThrowError(
|
||||
'cannot upgrade agent to 8.5.0 because it is higher than the installed kibana version 8.4.0'
|
||||
);
|
||||
});
|
||||
|
||||
it('should not throw if upgrade version is equal to kibana version with snapshot', () => {
|
||||
expect(() => checkKibanaVersion('8.4.0', '8.4.0-SNAPSHOT')).not.toThrowError();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -160,7 +160,7 @@ export const checkKibanaVersion = (version: string, kibanaVersion: string) => {
|
|||
if (!versionToUpgradeNumber)
|
||||
throw new Error(`version to upgrade ${versionToUpgradeNumber} is not valid`);
|
||||
|
||||
if (semverGt(version, kibanaVersion))
|
||||
if (semverGt(versionToUpgradeNumber, kibanaVersionNumber))
|
||||
throw new Error(
|
||||
`cannot upgrade agent to ${versionToUpgradeNumber} because it is higher than the installed kibana version ${kibanaVersionNumber}`
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue