-
Notifications
You must be signed in to change notification settings - Fork 884
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
299 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/plugins/data_source/server/legacy/client_config.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { DataSourcePluginConfigType } from '../../config'; | ||
import { parseClientOptions } from './client_config'; | ||
|
||
const TEST_DATA_SOURCE_ENDPOINT = 'http://datasource.com'; | ||
|
||
const config = { | ||
enabled: true, | ||
clientPool: { | ||
size: 5, | ||
}, | ||
} as DataSourcePluginConfigType; | ||
|
||
describe('parseClientOptions', () => { | ||
test('include the ssl client configs as defaults', () => { | ||
expect(parseClientOptions(config, TEST_DATA_SOURCE_ENDPOINT)).toEqual( | ||
expect.objectContaining({ | ||
host: TEST_DATA_SOURCE_ENDPOINT, | ||
ssl: { | ||
rejectUnauthorized: true, | ||
}, | ||
}) | ||
); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
src/plugins/data_source/server/legacy/configure_legacy_client.test.mocks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export const ClientMock = jest.fn(); | ||
jest.doMock('elasticsearch', () => { | ||
const actual = jest.requireActual('elasticsearch'); | ||
return { | ||
...actual, | ||
Client: ClientMock, | ||
}; | ||
}); | ||
|
||
export const parseClientOptionsMock = jest.fn(); | ||
jest.doMock('./client_config', () => ({ | ||
parseClientOptions: parseClientOptionsMock, | ||
})); |
Oops, something went wrong.