From 36b8d91aba2896f5966f2e8128fd08863106b9c7 Mon Sep 17 00:00:00 2001 From: Miki Date: Thu, 1 Dec 2022 11:43:55 -0800 Subject: [PATCH] Makes tests covering plugin installation on cluster snapshots work across platforms (#2994) Signed-off-by: Miki Signed-off-by: Miki Signed-off-by: Arpit Bandejiya --- CHANGELOG.md | 1 + .../osd-opensearch/src/integration_tests/cluster.test.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bdc2bbe1b2f..d7be07729e4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multi DataSource] Add unit test coverage for Update Data source management stack ([#2567](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2567)) - [BWC Tests] Add BWC tests for 2.5.0 ([#2890](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2890)) - Fix incorrect validation of time values in JUnit Reporter ([#2965](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2965)) +- Make tests covering plugin installation on cluster snapshots work across platforms ([#2994](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2994)) ## [2.x] diff --git a/packages/osd-opensearch/src/integration_tests/cluster.test.js b/packages/osd-opensearch/src/integration_tests/cluster.test.js index 7b4105aefd49..c873f1e6be4d 100644 --- a/packages/osd-opensearch/src/integration_tests/cluster.test.js +++ b/packages/osd-opensearch/src/integration_tests/cluster.test.js @@ -293,14 +293,17 @@ describe('#start(installPath)', () => { }); describe('#installOpenSearchPlugins()', () => { + const pluginHelperCLI = + process.platform === 'win32' ? './bin/opensearch-plugin.bat' : './bin/opensearch-plugin'; + it('install array of plugins on cluster snapshot', async () => { const cluster = new Cluster({ log }); await cluster.installOpenSearchPlugins('foo', ['foo1', 'foo2']); expect(execa).toHaveBeenCalledTimes(2); - expect(execa).toHaveBeenCalledWith('./bin/opensearch-plugin', ['install', '--batch', 'foo1'], { + expect(execa).toHaveBeenCalledWith(pluginHelperCLI, ['install', '--batch', 'foo1'], { cwd: 'foo', }); - expect(execa).toHaveBeenCalledWith('./bin/opensearch-plugin', ['install', '--batch', 'foo2'], { + expect(execa).toHaveBeenCalledWith(pluginHelperCLI, ['install', '--batch', 'foo2'], { cwd: 'foo', }); }); @@ -308,7 +311,7 @@ describe('#installOpenSearchPlugins()', () => { const cluster = new Cluster({ log }); await cluster.installOpenSearchPlugins('foo', 'foo1'); expect(execa).toHaveBeenCalledTimes(1); - expect(execa).toHaveBeenCalledWith('./bin/opensearch-plugin', ['install', '--batch', 'foo1'], { + expect(execa).toHaveBeenCalledWith(pluginHelperCLI, ['install', '--batch', 'foo1'], { cwd: 'foo', }); });