From 7bbfb25a04b00f2c99e678acf0588e5a48199f09 Mon Sep 17 00:00:00 2001 From: Aigerim Suleimenova Date: Sun, 16 Apr 2023 06:59:35 +0600 Subject: [PATCH 1/4] resolving get_keystore unit test Signed-off-by: Aigerim Suleimenova --- src/cli_keystore/get_keystore.test.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cli_keystore/get_keystore.test.js b/src/cli_keystore/get_keystore.test.js index ec838a6b956f..2e05657e4ae8 100644 --- a/src/cli_keystore/get_keystore.test.js +++ b/src/cli_keystore/get_keystore.test.js @@ -32,6 +32,8 @@ import { getKeystore } from './get_keystore'; import { Logger } from '../cli_plugin/lib/logger'; import fs from 'fs'; import sinon from 'sinon'; +import { getConfigDirectory, getDataPath } from '@osd/utils'; +import { join } from 'path'; describe('get_keystore', () => { const sandbox = sinon.createSandbox(); @@ -45,15 +47,19 @@ describe('get_keystore', () => { }); it('uses the config directory if there is no pre-existing keystore', () => { + const configKeystore = join(getConfigDirectory(), 'opensearch_dashboards.keystore'); + const dataKeystore = join(getDataPath(), 'opensearch_dashboards.keystore'); sandbox.stub(fs, 'existsSync').returns(false); - expect(getKeystore()).toContain('config'); - expect(getKeystore()).not.toContain('data'); + expect(getKeystore()).toContain(configKeystore); + expect(getKeystore()).not.toContain(dataKeystore); }); it('uses the data directory if there is a pre-existing keystore in the data directory', () => { + const configKeystore = join(getConfigDirectory(), 'opensearch_dashboards.keystore'); + const dataKeystore = join(getDataPath(), 'opensearch_dashboards.keystore'); sandbox.stub(fs, 'existsSync').returns(true); - expect(getKeystore()).toContain('data'); - expect(getKeystore()).not.toContain('config'); + expect(getKeystore()).toContain(dataKeystore); + expect(getKeystore()).not.toContain(configKeystore); }); it('logs a deprecation warning if the data directory is used', () => { From e8d46be3e5db180666d1bfa2770ad42b640d1e5f Mon Sep 17 00:00:00 2001 From: Aigerim Suleimenova Date: Sun, 16 Apr 2023 07:16:45 +0600 Subject: [PATCH 2/4] test Signed-off-by: Aigerim Suleimenova --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 062c3205f947..c5d157ad59e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -197,6 +197,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [BWC Tests] Add BWC tests for 2.6.0 ([#3356](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3356)) - Prevent primitive linting limitations from being applied to unit tests found under `src/setup_node_env` ([#3403](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3403)) - [Tests] Use `scripts/use_node` instead of `node` in functional test plugins ([#3783](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3783)) +- [Tests] Resolves the issue with get_keystore.js test([#3854]https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854) ## [2.x] From 7097f1b239ff3ecc4a4fe0cb201f7cbf01a5e0dc Mon Sep 17 00:00:00 2001 From: "Qingyang(Abby) Hu" Date: Mon, 17 Apr 2023 10:40:34 -0700 Subject: [PATCH 3/4] Update CHANGELOG.md Co-authored-by: Miki Signed-off-by: abbyhu2000 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5d157ad59e5..5588a5970f67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -196,8 +196,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Vis Builder] Adds field unit tests ([#3211](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3211)) - [BWC Tests] Add BWC tests for 2.6.0 ([#3356](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3356)) - Prevent primitive linting limitations from being applied to unit tests found under `src/setup_node_env` ([#3403](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3403)) +- [Tests] Fix unit tests for `get_keystore` ([#3854]https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854) - [Tests] Use `scripts/use_node` instead of `node` in functional test plugins ([#3783](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3783)) -- [Tests] Resolves the issue with get_keystore.js test([#3854]https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854) ## [2.x] From b172eefe9883674b0815783c1e7b1281f695bfd5 Mon Sep 17 00:00:00 2001 From: "Qingyang(Abby) Hu" Date: Mon, 17 Apr 2023 10:44:28 -0700 Subject: [PATCH 4/4] Update CHANGELOG.md Fix Changelog entry format Signed-off-by: abbyhu2000 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5588a5970f67..2eef66f11946 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -196,7 +196,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Vis Builder] Adds field unit tests ([#3211](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3211)) - [BWC Tests] Add BWC tests for 2.6.0 ([#3356](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3356)) - Prevent primitive linting limitations from being applied to unit tests found under `src/setup_node_env` ([#3403](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3403)) -- [Tests] Fix unit tests for `get_keystore` ([#3854]https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854) +- [Tests] Fix unit tests for `get_keystore` ([#3854](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854)) - [Tests] Use `scripts/use_node` instead of `node` in functional test plugins ([#3783](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3783)) ## [2.x]