diff --git a/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts b/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts index f12e265f36630..1b682bfb6f456 100644 --- a/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts +++ b/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts @@ -70,7 +70,9 @@ export class FunctionalTestRunner { if (!this.esVersion.eql(esInfo.version.number)) { throw new Error( - `ES reports a version number "${esInfo.version.number}" which doesn't match supplied es version "${this.esVersion}"` + `ES reports a version number "${ + esInfo.version.number + }" which doesn't match supplied es version "${this.esVersion.toString()}"` ); } } diff --git a/packages/kbn-test/src/functional_test_runner/lib/es_version.ts b/packages/kbn-test/src/functional_test_runner/lib/es_version.ts index 7ef5764fcdd4a..8b3acde47a4dc 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/es_version.ts +++ b/packages/kbn-test/src/functional_test_runner/lib/es_version.ts @@ -34,6 +34,10 @@ export class EsVersion { this.parsed = parsed; } + toString() { + return this.parsed.version; + } + /** * Determine if the ES version matches a semver range, like >=7 or ^8.1.0 */ @@ -45,6 +49,7 @@ export class EsVersion { * Determine if the ES version matches a specific version, ignores things like -SNAPSHOT */ eql(version: string) { - return semver.compareLoose(this.parsed, version) === 0; + const other = semver.coerce(version); + return other && semver.compareLoose(this.parsed, other) === 0; } } diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/filter_suites.ts b/packages/kbn-test/src/functional_test_runner/lib/mocha/filter_suites.ts index 725b930791457..148b074b82969 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/mocha/filter_suites.ts +++ b/packages/kbn-test/src/functional_test_runner/lib/mocha/filter_suites.ts @@ -43,7 +43,7 @@ export function filterSuites({ log, mocha, include, exclude, esVersion }: Option suite.suites.reduce((acc, s) => acc.concat(collectTests(s)), suite.tests); // traverse the test graph and exclude any tests which don't meet their esVersionRequirement - log.info('Only running suites which are compatible with ES version', esVersion); + log.info('Only running suites which are compatible with ES version', esVersion.toString()); (function recurse(parentSuite: SuiteInternal) { const children = parentSuite.suites; parentSuite.suites = [];