mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[ES] Handle non-semver-compliant versions (#172093)
This commit is contained in:
parent
8e36ba77f6
commit
a77c4c0b69
3 changed files with 16 additions and 0 deletions
|
@ -42,6 +42,12 @@ describe('mapNodesVersionCompatibility', () => {
|
|||
return { nodes: { 'node-without-http': { version, ip: 'ip' } } } as any;
|
||||
}
|
||||
|
||||
it('returns isCompatible=false with a single node with non-SemVer-compliant version', async () => {
|
||||
const nodesInfo = createNodes('615c621a8416c444941dc97b142a0122d5c878d0');
|
||||
const result = await mapNodesVersionCompatibility(nodesInfo, KIBANA_VERSION, false);
|
||||
expect(result.isCompatible).toBe(false);
|
||||
});
|
||||
|
||||
it('returns isCompatible=true with a single node that matches', async () => {
|
||||
const nodesInfo = createNodes('5.1.0');
|
||||
const result = await mapNodesVersionCompatibility(nodesInfo, KIBANA_VERSION, false);
|
||||
|
|
|
@ -22,6 +22,12 @@ describe('plugins/elasticsearch', () => {
|
|||
it('when majors are equal, but ES minor is less than Kibana minor', () => {
|
||||
expect(esVersionCompatibleWithKibana('1.0.0', '1.1.0')).toBe(false);
|
||||
});
|
||||
|
||||
it('ES is not SemVer-compliant', () => {
|
||||
expect(
|
||||
esVersionCompatibleWithKibana('615c621a8416c444941dc97b142a0122d5c878d0', '1.1.0')
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('returns true', () => {
|
||||
|
|
|
@ -14,6 +14,10 @@ import semver, { coerce } from 'semver';
|
|||
* 2. Older versions of ES won't work with newer versions of Kibana.
|
||||
*/
|
||||
export function esVersionCompatibleWithKibana(esVersion: string, kibanaVersion: string) {
|
||||
if (!semver.valid(esVersion)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const esVersionNumbers = {
|
||||
major: semver.major(esVersion),
|
||||
minor: semver.minor(esVersion),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue