diff --git a/.github/workflows/build_and_test_workflow.yml b/.github/workflows/build_and_test_workflow.yml index 94b59373d101..f9e54b445373 100644 --- a/.github/workflows/build_and_test_workflow.yml +++ b/.github/workflows/build_and_test_workflow.yml @@ -104,8 +104,13 @@ jobs: npm uninstall -g yarn npm i -g yarn@1.22.10 + # https://github.com/yarnpkg/yarn/issues/8242#issuecomment-776561223 + # Increase network timeout for Windows, retry once if bootstrap fails - name: Run bootstrap - run: yarn osd bootstrap + run: | + yarn cache clean + yarn config set network-timeout 1000000 -g + yarn osd bootstrap || yarn osd bootstrap - name: Run linter id: linter @@ -178,6 +183,14 @@ jobs: JOB: ci${{ matrix.group }} CACHE_DIR: ciGroup${{ matrix.group }} + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: failure-artifacts + path: | + test/*/failure_debug/ + test/*/screenshots/ + functional-tests-windows: runs-on: windows-latest name: Run functional tests on Windows @@ -214,8 +227,13 @@ jobs: - name: Setup chromedriver run: node scripts/upgrade_chromedriver.js + # https://github.com/yarnpkg/yarn/issues/8242#issuecomment-776561223 + # Increase network timeout for Windows, retry once if bootstrap fails - name: Run bootstrap - run: yarn osd bootstrap + run: | + yarn cache clean + yarn config set network-timeout 1000000 -g + yarn osd bootstrap || yarn osd bootstrap - name: Build plugins run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 10 @@ -229,6 +247,14 @@ jobs: JOB: ci${{ matrix.group }} CACHE_DIR: ciGroup${{ matrix.group }} + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: failure-artifacts-ci${{ matrix.group }} + path: | + test/*/failure_debug/ + test/*/screenshots/ + build-min-artifact-tests-linux: runs-on: ubuntu-latest container: diff --git a/.node-version b/.node-version index a3eb5a03fa6a..285152276014 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -14.20.0 +14.20.1 diff --git a/.nvmrc b/.nvmrc index a3eb5a03fa6a..285152276014 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14.20.0 +14.20.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1be6108397eb..693ea0cbd764 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Eliminate dependency on `got` versions older than 11.8.5 ([#2801](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2801)) - [Multi DataSource] Add explicit no spellcheck on password fields ([#2818](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2818)) - [CVE-2022-25912] Bumps simple-git from 3.4.0 to 3.15.0 ([#3036](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3036)) +- [CVE-2022-35256] Bumps node version from 14.20.0 to 14.20.1 [#3166](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3166)) ### 📈 Features/Enhancements @@ -51,8 +52,11 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Doc] Add current plugin persistence implementation readme ([#3081](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3081)) - [Table Visualization] Refactor table visualization using React and DataGrid component ([#2863](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2863)) - [Vis Builder] Add redux store persistence ([#3088](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3088)) +- [Multi DataSource] Improve test connection ([#3110](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3110)) +- [Optimizer] Increase timeout waiting for the exiting of an optimizer worker ([#3193](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3193)) - [Data] Update `createAggConfig` so that newly created configs can be added to beginning of `aggConfig` array ([#3160](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3160)) + ### 🐛 Bug Fixes - [Vis Builder] Fixes auto bounds for timeseries bar chart visualization ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401)) @@ -81,6 +85,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Table Visualization][BUG] Fix Url content display issue in table ([#2918](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2918)) - Fixes misleading embaddable plugin error message ([#3043](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3043)) - [MD] Update dummy url in tests to follow lychee url allowlist ([#3099](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3099)) +- Adds config override to fix obsolete theme:version config value of v8 (beta) rendering issue ([#3045](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3045)) +- [CI] Update test workflow to increase network-timeout for yarn for installing dependencies ([#3118](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3118)) ### 🚞 Infrastructure @@ -89,7 +95,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Re-enable CI workflows for feature branckes ([#2908](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2908)) - Add Windows CI workflows ([#2966](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2966)) - Add automatic selection of the appropriate version of chrome driver to run functional tests ([#2990](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2990)) - +- Add recording of functional test artifacts if they fail ([#3190](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3190)) ### 📝 Documentation @@ -118,6 +124,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)) +- Add retrial of flaky tests ([#2967](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2967)) - 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)) - Correct the linting logic for `no-restricted-path` to ignore trailing slashes ([#3020](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3020)) diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index 4fe8fc4e368c..af3cce9f61a0 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -36,6 +36,11 @@ $ npm i -g yarn $ yarn osd bootstrap # This command will also install npm dependencies ``` +If you experience a network timeout while bootstrapping, you can update the timeout by configuring it in the `.yarnrc`. For example: +``` +network-timeout 1000000 +``` + ### Configure OpenSearch Dashboards *This step is only mandatory if you have https/authentication enabled, or if you use the OpenSearch Docker image in its default configuration.* diff --git a/Dockerfile b/Dockerfile index 10639bbbe16f..8f2742a6c1f2 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG NODE_VERSION=14.20.0 +ARG NODE_VERSION=14.20.1 FROM node:${NODE_VERSION} AS base ENV HOME '.' diff --git a/MAINTAINERS.md b/MAINTAINERS.md index addf5d2c8498..717903ef2915 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -1,13 +1,16 @@ -# OpenSearch-Dashboards Maintainers +## Overview + +This document contains a list of maintainers in this repo. See [opensearch-project/.github/RESPONSIBILITIES.md](https://github.com/opensearch-project/.github/blob/main/RESPONSIBILITIES.md#maintainer-responsibilities) that explains what the role of maintainer means, what maintainers do in this and other repos, and how they should be doing it. If you're interested in contributing, and becoming a maintainer, see [CONTRIBUTING](CONTRIBUTING.md). + +## Current Maintainers -## Maintainers | Maintainer | GitHub ID | Affiliation | | ------------------------- | --------------------------------------------------- | ----------- | | Anan Zhuang | [ananzh](https://github.com/ananzh) | Amazon | | Bishoy Boktor | [boktorbb](https://github.com/boktorbb) | Amazon | | Mihir Soni | [mihirsoni](https://github.com/mihirsoni) | Amazon | | Kawika (Rocky) Avilla | [kavilla](https://github.com/kavilla) | Amazon | -| Sean Neumann | [seanneumann](https://github.com/seanneumann) | Amazon | +| Sean Neumann | [seanneumann](https://github.com/seanneumann) | Amazon | | Miki Barahmand | [AMoo-Miki](https://github.com/AMoo-Miki) | Amazon | | Ashwin P Chandran | [ashwin-pc](https://github.com/ashwin-pc) | Amazon | | Josh Romero | [joshuarrrr](https://github.com/joshuarrrr) | Amazon | @@ -19,8 +22,6 @@ ## Emeritus -| Maintainer | GitHub ID | Affiliation | -| ------------------------- | --------------------------------------------------- | ----------- | -| Tommy Markley | [tmarkley](https://github.com/tmarkley) | Amazon | - -[This document](https://github.com/opensearch-project/.github/blob/main/MAINTAINERS.md) explains what maintainers do, and how they should be doing it. If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md). +| Maintainer | GitHub ID | Affiliation | +| ------------- | --------------------------------------- | ----------- | +| Tommy Markley | [tmarkley](https://github.com/tmarkley) | Amazon | diff --git a/TESTING.md b/TESTING.md index 68077547ef88..9cca21b7eee6 100644 --- a/TESTING.md +++ b/TESTING.md @@ -24,7 +24,7 @@ In general, we recommend four tiers of tests: # Requirements * Install the latest NodeJS, [NPM](https://www.npmjs.com/get-npm) and [Yarn](https://classic.yarnpkg.com/en/docs/install/#mac-stable) - * `nvm install v14.20.0` + * `nvm install v14.20.1` * `npm install -g yarn` # Running tests diff --git a/package.json b/package.json index d363e7bb0d66..d8095638d190 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,9 @@ "**/qs": "^6.10.3", "**/trim": "^0.0.3", "**/typescript": "4.0.2", - "**/unset-value": "^2.0.1" + "**/unset-value": "^2.0.1", + "**/jest-config": "npm:@amoo-miki/jest-config@27.5.1", + "**/jest-jasmine2": "npm:@amoo-miki/jest-jasmine2@27.5.1" }, "workspaces": { "packages": [ @@ -463,7 +465,7 @@ "zlib": "^1.0.5" }, "engines": { - "node": "14.20.0", + "node": "14.20.1", "yarn": "^1.21.1" } } diff --git a/packages/osd-optimizer/src/worker/run_worker.ts b/packages/osd-optimizer/src/worker/run_worker.ts index e41c917a883a..2997444eb0ef 100644 --- a/packages/osd-optimizer/src/worker/run_worker.ts +++ b/packages/osd-optimizer/src/worker/run_worker.ts @@ -78,11 +78,13 @@ const exit = (code: number) => { setTimeout(() => { send( workerMsgs.error( - new Error('process did not automatically exit within 5 seconds, forcing exit') + new Error( + `process did not automatically exit within 15 seconds (previous code: ${code}); forcing exit...` + ) ) ); process.exit(1); - }, 5000).unref(); + }, 15000).unref(); }; // check for connected parent on an unref'd timer rather than listening diff --git a/src/core/server/ui_settings/ui_settings_client.test.ts b/src/core/server/ui_settings/ui_settings_client.test.ts index 72461653d652..a7aa95ebab91 100644 --- a/src/core/server/ui_settings/ui_settings_client.test.ts +++ b/src/core/server/ui_settings/ui_settings_client.test.ts @@ -624,6 +624,29 @@ describe('ui settings', () => { expect(await uiSettings.get('dateFormat')).toBe('foo'); }); + it('returns the overridden value for key theme:version', async () => { + const opensearchDocSource = { 'theme:version': 'v8 (beta)' }; + const overrides = { 'theme:version': 'v7' }; + const { uiSettings } = setup({ opensearchDocSource, overrides }); + + expect(await uiSettings.get('theme:version')).toBe('v7'); + }); + + it('returns the overridden value for key theme:version when doc source is empty', async () => { + const opensearchDocSource = {}; + const overrides = { 'theme:version': 'v7' }; + const { uiSettings } = setup({ opensearchDocSource, overrides }); + + expect(await uiSettings.get('theme:version')).toBe('v7'); + }); + + it('rewrites the key theme:version value without override', async () => { + const opensearchDocSource = { 'theme:version': 'v8 (beta)' }; + const { uiSettings } = setup({ opensearchDocSource }); + + expect(await uiSettings.get('theme:version')).toBe('v8 (beta)'); + }); + it('returns the default value for an override with value null', async () => { const opensearchDocSource = { dateFormat: 'YYYY-MM-DD' }; const overrides = { dateFormat: null }; diff --git a/src/core/server/ui_settings/ui_settings_config.ts b/src/core/server/ui_settings/ui_settings_config.ts index 4c3dd0e4dcf5..634fb5c62d55 100644 --- a/src/core/server/ui_settings/ui_settings_config.ts +++ b/src/core/server/ui_settings/ui_settings_config.ts @@ -38,7 +38,12 @@ const deprecations: ConfigDeprecationProvider = ({ unused, renameFromRoot }) => ]; const configSchema = schema.object({ - overrides: schema.object({}, { unknowns: 'allow' }), + overrides: schema.object( + { + 'theme:version': schema.string({ defaultValue: 'v7' }), + }, + { unknowns: 'allow' } + ), }); export type UiSettingsConfigType = TypeOf; diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index 6eb7b4013354..8dd5240f69de 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -109,4 +109,5 @@ export default { globals: { Uint8Array: Uint8Array, }, + flakyTestRetries: 2, }; diff --git a/src/plugins/data_source/common/data_sources/types.ts b/src/plugins/data_source/common/data_sources/types.ts index 29b4e3c3128f..afcf3d662fed 100644 --- a/src/plugins/data_source/common/data_sources/types.ts +++ b/src/plugins/data_source/common/data_sources/types.ts @@ -6,7 +6,6 @@ import { SavedObjectAttributes } from 'src/core/types'; export interface DataSourceAttributes extends SavedObjectAttributes { - id?: string; title: string; description?: string; endpoint: string; diff --git a/src/plugins/data_source/server/client/configure_client.ts b/src/plugins/data_source/server/client/configure_client.ts index 3f8a64f71d86..cc9bcfd9b361 100644 --- a/src/plugins/data_source/server/client/configure_client.ts +++ b/src/plugins/data_source/server/client/configure_client.ts @@ -25,7 +25,7 @@ export const configureClient = async ( logger: Logger ): Promise => { try { - const { attributes: dataSource } = await getDataSource(dataSourceId, savedObjects); + const { attributes: dataSource } = await getDataSource(dataSourceId!, savedObjects); const rootClient = getRootClient(dataSource, config, openSearchClientPoolSetup); return await getQueryClient(rootClient, dataSource, cryptography); @@ -38,7 +38,7 @@ export const configureClient = async ( }; export const configureTestClient = async ( - { savedObjects, cryptography }: DataSourceClientParams, + { savedObjects, cryptography, dataSourceId }: DataSourceClientParams, dataSource: DataSourceAttributes, openSearchClientPoolSetup: OpenSearchClientPoolSetup, config: DataSourcePluginConfigType, @@ -46,28 +46,21 @@ export const configureTestClient = async ( ): Promise => { try { const { - id, auth: { type, credentials }, } = dataSource; let requireDecryption = false; const rootClient = getRootClient(dataSource, config, openSearchClientPoolSetup); - if (type === AuthType.UsernamePasswordType && !credentials?.password && id) { - const { attributes: fetchedDataSource } = await getDataSource(id || '', savedObjects); - dataSource.auth = { - type, - credentials: { - username: credentials?.username || '', - password: fetchedDataSource.auth.credentials?.password || '', - }, - }; + if (type === AuthType.UsernamePasswordType && !credentials?.password && dataSourceId) { + const dataSourceSavedObject = await getDataSource(dataSourceId, savedObjects); + dataSource = dataSourceSavedObject.attributes; requireDecryption = true; } return getQueryClient(rootClient, dataSource, cryptography, requireDecryption); } catch (error: any) { - logger.error(`Failed to get data source client for dataSource: ${dataSource}`); + logger.error(`Failed to get test client for dataSource: ${dataSource}`); logger.error(error); // Re-throw as DataSourceError throw createDataSourceError(error); diff --git a/src/plugins/data_source/server/data_source_service.ts b/src/plugins/data_source/server/data_source_service.ts index f841c2ec3067..798fce739216 100644 --- a/src/plugins/data_source/server/data_source_service.ts +++ b/src/plugins/data_source/server/data_source_service.ts @@ -40,8 +40,8 @@ export class DataSourceService { } async setup(config: DataSourcePluginConfigType): Promise { - const opensearchClientPoolSetup = await this.openSearchClientPool.setup(config); - const legacyClientPoolSetup = await this.legacyClientPool.setup(config); + const opensearchClientPoolSetup = this.openSearchClientPool.setup(config); + const legacyClientPoolSetup = this.legacyClientPool.setup(config); const getDataSourceClient = async ( params: DataSourceClientParams diff --git a/src/plugins/data_source/server/legacy/configure_legacy_client.test.ts b/src/plugins/data_source/server/legacy/configure_legacy_client.test.ts index f5a192a1cae5..bfdf0ce585f0 100644 --- a/src/plugins/data_source/server/legacy/configure_legacy_client.test.ts +++ b/src/plugins/data_source/server/legacy/configure_legacy_client.test.ts @@ -19,7 +19,7 @@ import { configureLegacyClient } from './configure_legacy_client'; const DATA_SOURCE_ID = 'a54b76ec86771ee865a0f74a305dfff8'; // TODO: improve UT -describe.skip('configureLegacyClient', () => { +describe('configureLegacyClient', () => { let logger: ReturnType; let config: DataSourcePluginConfigType; let savedObjectsMock: jest.Mocked; diff --git a/src/plugins/data_source/server/legacy/configure_legacy_client.ts b/src/plugins/data_source/server/legacy/configure_legacy_client.ts index 94e6b40a4d2e..137d5b506fb3 100644 --- a/src/plugins/data_source/server/legacy/configure_legacy_client.ts +++ b/src/plugins/data_source/server/legacy/configure_legacy_client.ts @@ -33,10 +33,10 @@ export const configureLegacyClient = async ( logger: Logger ) => { try { - const dataSource = await getDataSource(dataSourceId, savedObjects); + const dataSource = await getDataSource(dataSourceId!, savedObjects); const rootClient = getRootClient(dataSource.attributes, config, openSearchClientPoolSetup); - return await getQueryClient(rootClient, dataSource, cryptography, callApiParams); + return await getQueryClient(rootClient, dataSource.attributes, cryptography, callApiParams); } catch (error: any) { logger.error(`Failed to get data source client for dataSourceId: [${dataSourceId}]`); logger.error(error); @@ -55,11 +55,11 @@ export const configureLegacyClient = async ( */ const getQueryClient = async ( rootClient: Client, - dataSource: SavedObject, + dataSource: DataSourceAttributes, cryptography: CryptographyServiceSetup, { endpoint, clientParams, options }: LegacyClientCallAPIParams ) => { - const authType = dataSource.attributes.auth.type; + const authType = dataSource.auth.type; switch (authType) { case AuthType.NoAuth: diff --git a/src/plugins/data_source/server/lib/error.ts b/src/plugins/data_source/server/lib/error.ts index 9a9866a072d6..9d1108e13e16 100644 --- a/src/plugins/data_source/server/lib/error.ts +++ b/src/plugins/data_source/server/lib/error.ts @@ -11,9 +11,18 @@ import { OsdError } from '../../../opensearch_dashboards_utils/common'; export class DataSourceError extends OsdError { // must have statusCode to avoid route handler in search.ts to return 500 statusCode: number; - constructor(error: any, message?: string, statusCode?: number) { - message = message ? message : error.message; + constructor(error: any, context?: string, statusCode?: number) { + let message: string; + if (context) { + message = context; + } else if (isResponseError(error)) { + message = JSON.stringify(error.meta.body); + } else { + message = error.message; + } + super('Data Source Error: ' + message); + if (statusCode) { this.statusCode = statusCode; } else if (error.statusCode) { diff --git a/src/plugins/data_source/server/routes/data_source_connection_validator.ts b/src/plugins/data_source/server/routes/data_source_connection_validator.ts index b23a92624d2a..ecec07dafcc4 100644 --- a/src/plugins/data_source/server/routes/data_source_connection_validator.ts +++ b/src/plugins/data_source/server/routes/data_source_connection_validator.ts @@ -13,11 +13,7 @@ export class DataSourceConnectionValidator { try { return await this.callDataCluster.info(); } catch (e) { - if (e.statusCode === 403) { - return true; - } else { - throw createDataSourceError(e); - } + throw createDataSourceError(e); } } } diff --git a/src/plugins/data_source/server/routes/test_connection.ts b/src/plugins/data_source/server/routes/test_connection.ts index edebd4feb91f..8f90577b045f 100644 --- a/src/plugins/data_source/server/routes/test_connection.ts +++ b/src/plugins/data_source/server/routes/test_connection.ts @@ -20,36 +20,40 @@ export const registerTestConnectionRoute = ( path: '/internal/data-source-management/validate', validate: { body: schema.object({ - id: schema.string(), - endpoint: schema.string(), - auth: schema.maybe( - schema.object({ - type: schema.oneOf([schema.literal('username_password'), schema.literal('no_auth')]), - credentials: schema.oneOf([ - schema.object({ - username: schema.string(), - password: schema.string(), - }), - schema.literal(null), - ]), - }) - ), + id: schema.maybe(schema.string()), + dataSourceAttr: schema.object({ + endpoint: schema.string(), + auth: schema.maybe( + schema.object({ + type: schema.oneOf([ + schema.literal('username_password'), + schema.literal('no_auth'), + ]), + credentials: schema.oneOf([ + schema.object({ + username: schema.string(), + password: schema.string(), + }), + schema.literal(null), + ]), + }) + ), + }), }), }, }, async (context, request, response) => { - const dataSource: DataSourceAttributes = request.body as DataSourceAttributes; - - const dataSourceClient: OpenSearchClient = await dataSourceServiceSetup.getTestingClient( - { - dataSourceId: dataSource.id || '', - savedObjects: context.core.savedObjects.client, - cryptography, - }, - dataSource - ); + const { dataSourceAttr, id: dataSourceId } = request.body; try { + const dataSourceClient: OpenSearchClient = await dataSourceServiceSetup.getTestingClient( + { + dataSourceId, + savedObjects: context.core.savedObjects.client, + cryptography, + }, + dataSourceAttr as DataSourceAttributes + ); const dsValidator = new DataSourceConnectionValidator(dataSourceClient); await dsValidator.validate(); diff --git a/src/plugins/data_source/server/types.ts b/src/plugins/data_source/server/types.ts index cf2748d046d7..913218e40d4b 100644 --- a/src/plugins/data_source/server/types.ts +++ b/src/plugins/data_source/server/types.ts @@ -19,7 +19,8 @@ export interface LegacyClientCallAPIParams { } export interface DataSourceClientParams { - dataSourceId: string; + // id is optional when creating test client + dataSourceId?: string; // this saved objects client is used to fetch data source on behalf of users, caller should pass scoped saved objects client savedObjects: SavedObjectsClientContract; cryptography: CryptographyServiceSetup; diff --git a/src/plugins/data_source_management/public/components/utils.test.ts b/src/plugins/data_source_management/public/components/utils.test.ts index 99bb126933a5..ec30c7966971 100644 --- a/src/plugins/data_source_management/public/components/utils.test.ts +++ b/src/plugins/data_source_management/public/components/utils.test.ts @@ -156,7 +156,7 @@ describe('DataSourceManagement: Utils.ts', () => { Array [ "/internal/data-source-management/validate", Object { - "body": "{\\"id\\":\\"\\",\\"endpoint\\":\\"https://test.com\\",\\"auth\\":{\\"type\\":\\"no_auth\\",\\"credentials\\":null}}", + "body": "{\\"dataSourceAttr\\":{\\"endpoint\\":\\"https://test.com\\",\\"auth\\":{\\"type\\":\\"no_auth\\",\\"credentials\\":null}}}", }, ], ] @@ -170,7 +170,7 @@ describe('DataSourceManagement: Utils.ts', () => { Array [ "/internal/data-source-management/validate", Object { - "body": "{\\"id\\":\\"test1234\\",\\"endpoint\\":\\"https://test.com\\",\\"auth\\":{\\"type\\":\\"no_auth\\",\\"credentials\\":null}}", + "body": "{\\"id\\":\\"test1234\\",\\"dataSourceAttr\\":{\\"endpoint\\":\\"https://test.com\\",\\"auth\\":{\\"type\\":\\"no_auth\\",\\"credentials\\":null}}}", }, ], ] diff --git a/src/plugins/data_source_management/public/components/utils.ts b/src/plugins/data_source_management/public/components/utils.ts index dafc03777fca..3d9d6f51b413 100644 --- a/src/plugins/data_source_management/public/components/utils.ts +++ b/src/plugins/data_source_management/public/components/utils.ts @@ -85,11 +85,13 @@ export async function testConnection( dataSourceID?: string ) { const query: any = { - id: dataSourceID || '', - endpoint, - auth: { - type, - credentials: type === AuthType.NoAuth ? null : { ...credentials }, + id: dataSourceID, + dataSourceAttr: { + endpoint, + auth: { + type, + credentials: type === AuthType.NoAuth ? null : { ...credentials }, + }, }, }; diff --git a/yarn.lock b/yarn.lock index 91ed149471ad..fae04a04302c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10821,10 +10821,10 @@ jest-cli@^27.5.1: prompts "^2.0.1" yargs "^16.2.0" -jest-config@^27.5.1: +jest-config@^27.5.1, "jest-config@npm:@amoo-miki/jest-config@27.5.1": version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.5.1.tgz#5c387de33dca3f99ad6357ddeccd91bf3a0e4a41" - integrity sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA== + resolved "https://registry.yarnpkg.com/@amoo-miki/jest-config/-/jest-config-27.5.1.tgz#3afdb485fdccad8fd8b19be505747cafbf8e6707" + integrity sha512-6pSD/Lo5axflM2NO0eIHuJ40nxfXn2NQGqzOCrZO1EE7yS3k90p10RalInf8RXl2g9/f1Ax4U4aU2e3BWSaSaQ== dependencies: "@babel/core" "^7.8.0" "@jest/test-sequencer" "^27.5.1" @@ -10929,10 +10929,10 @@ jest-haste-map@^27.5.1: optionalDependencies: fsevents "^2.3.2" -jest-jasmine2@^27.5.1: +jest-jasmine2@^27.5.1, "jest-jasmine2@npm:@amoo-miki/jest-jasmine2@27.5.1": version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz#a037b0034ef49a9f3d71c4375a796f3b230d1ac4" - integrity sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ== + resolved "https://registry.yarnpkg.com/@amoo-miki/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz#0c99502f9879e1504b124da8355880924de1f310" + integrity sha512-oOihnJGLdFZO780Ts6XR+Sbs8d4J0+sqcNvBNcJch/LSKpQt7rARi0V+TgF80LRAvJI4gyq97az/2fdXXgxDNg== dependencies: "@jest/environment" "^27.5.1" "@jest/source-map" "^27.5.1" @@ -11726,7 +11726,7 @@ loader-runner@^2.4.0: resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== -loader-utils@^1.2.3, loader-utils@^2.0.0, loader-utils@^2.0.3, loader-utils@^2.0.4: +loader-utils@^1.2.3, loader-utils@^2.0.0, loader-utils@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c" integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==