From 33bd35b62452f9f56ff41a74cbe92507bafc9769 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Wed, 22 Jul 2020 14:49:35 -0500 Subject: [PATCH 1/3] [keystore] use get_keystore in server cli --- src/cli/serve/read_keystore.js | 7 +++---- src/cli/serve/read_keystore.test.js | 16 +++++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/cli/serve/read_keystore.js b/src/cli/serve/read_keystore.js index 962c708c0d8df..38d0e68bd5c4e 100644 --- a/src/cli/serve/read_keystore.js +++ b/src/cli/serve/read_keystore.js @@ -17,14 +17,13 @@ * under the License. */ -import path from 'path'; import { set } from '@elastic/safer-lodash-set'; import { Keystore } from '../../legacy/server/keystore'; -import { getDataPath } from '../../core/server/path'; +import { getKeystore } from '../../cli_keystore/get_keystore'; -export function readKeystore(dataPath = getDataPath()) { - const keystore = new Keystore(path.join(dataPath, 'kibana.keystore')); +export function readKeystore(keystorePath = getKeystore()) { + const keystore = new Keystore(keystorePath); keystore.load(); const keys = Object.keys(keystore.data); diff --git a/src/cli/serve/read_keystore.test.js b/src/cli/serve/read_keystore.test.js index b77e51fc3033a..e5407b257a909 100644 --- a/src/cli/serve/read_keystore.test.js +++ b/src/cli/serve/read_keystore.test.js @@ -40,11 +40,17 @@ describe('cli/serve/read_keystore', () => { }); }); - it('uses data path provided', () => { - const keystoreDir = '/foo/'; - const keystorePath = path.join(keystoreDir, 'kibana.keystore'); + it('uses data path if provided', () => { + const keystorePath = path.join('/foo/', 'kibana.keystore'); - readKeystore(keystoreDir); - expect(Keystore.mock.calls[0][0]).toEqual(keystorePath); + readKeystore(keystorePath); + expect(Keystore.mock.calls[0][0]).toContain(keystorePath); + }); + + it('uses the getKeystore path if not', () => { + readKeystore(); + // we test exact path scenarios in get_keystore.test.js - we use both + // deprecated and new to cover any older local environments + expect(Keystore.mock.calls[0][0]).toMatch(/data|config/); }); }); From 25f401aa2e1e669b8098ac67105682ad3f8e1095 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Wed, 22 Jul 2020 15:23:34 -0500 Subject: [PATCH 2/3] temporily add docker build so this can be retested in original env --- test/scripts/jenkins_xpack_build_kibana.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/scripts/jenkins_xpack_build_kibana.sh b/test/scripts/jenkins_xpack_build_kibana.sh index c962b962b1e5e..a427c7f67a968 100755 --- a/test/scripts/jenkins_xpack_build_kibana.sh +++ b/test/scripts/jenkins_xpack_build_kibana.sh @@ -34,7 +34,7 @@ node scripts/functional_tests --assert-none-excluded \ if [[ -z "$CODE_COVERAGE" ]] ; then echo " -> building and extracting default Kibana distributable for use in functional tests" cd "$KIBANA_DIR" - node scripts/build --debug --no-oss + node scripts/build --debug --no-oss --all-platforms linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')" installDir="$PARENT_DIR/install/kibana" mkdir -p "$installDir" From f3388a58ad729b66f47e9813743bfba758953469 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Wed, 22 Jul 2020 22:38:27 -0500 Subject: [PATCH 3/3] Revert "temporily add docker build so this can be retested in original env" This reverts commit 25f401aa2e1e669b8098ac67105682ad3f8e1095. --- test/scripts/jenkins_xpack_build_kibana.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/scripts/jenkins_xpack_build_kibana.sh b/test/scripts/jenkins_xpack_build_kibana.sh index a427c7f67a968..c962b962b1e5e 100755 --- a/test/scripts/jenkins_xpack_build_kibana.sh +++ b/test/scripts/jenkins_xpack_build_kibana.sh @@ -34,7 +34,7 @@ node scripts/functional_tests --assert-none-excluded \ if [[ -z "$CODE_COVERAGE" ]] ; then echo " -> building and extracting default Kibana distributable for use in functional tests" cd "$KIBANA_DIR" - node scripts/build --debug --no-oss --all-platforms + node scripts/build --debug --no-oss linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')" installDir="$PARENT_DIR/install/kibana" mkdir -p "$installDir"