[es] skip exact version warning in dev (#25350)

* [es] skip exact version warning in dev

* feedback

* Revert "feedback"

This reverts commit f8e8aaed2a.

* loose mismatch
This commit is contained in:
Jonathan Budzenski 2018-11-15 12:21:30 -06:00 committed by GitHub
parent e75bcdacd1
commit 8c3df98234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -42,6 +42,11 @@ describe('plugins/elasticsearch', () => {
},
url: esTestConfig.getUrl()
}
},
config() {
return {
get: sinon.stub()
};
}
};
});

View file

@ -23,6 +23,7 @@
*/
import { forEach, get } from 'lodash';
import { coerce } from 'semver';
import isEsCompatibleWithKibana from './is_es_compatible_with_kibana';
/**
@ -37,6 +38,7 @@ const lastWarnedNodesForServer = new WeakMap();
export function ensureEsVersion(server, kibanaVersion) {
const { callWithInternalUser } = server.plugins.elasticsearch.getCluster('admin');
const isProd = server.config().get('env.prod');
server.log(['plugin', 'debug'], 'Checking Elasticsearch version');
return callWithInternalUser('nodes.info', {
@ -61,7 +63,11 @@ export function ensureEsVersion(server, kibanaVersion) {
// It's acceptable if ES and Kibana versions are not the same so long as
// they are not incompatible, but we should warn about it
if (esNode.version !== kibanaVersion) {
// In development we ignore, this can be expected when testing against snapshots
// or across version qualifiers
const exactMisMatch = esNode.version !== kibanaVersion;
const looseMismatch = coerce(esNode.version).version !== coerce(kibanaVersion).version;
if (isProd && exactMisMatch || looseMismatch) {
warningNodes.push(esNode);
}
});