Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nodejs client] fix hookup issues in src/core/server/opensearch #1194

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/server/opensearch/client/cluster_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

import { Client } from '@opensearch-project/opensearch';
import { Client } from '@opensearch-project/opensearch/api/new';
import { Logger } from '../../logging';
import { GetAuthHeaders, Headers, isOpenSearchDashboardsRequest, isRealRequest } from '../../http';
import { ensureRawRequest, filterHeaders } from '../../http/router';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/opensearch/client/configure_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
import { Buffer } from 'buffer';
import { stringify } from 'querystring';
import { Client } from '@opensearch-project/opensearch';
import { Client } from '@opensearch-project/opensearch/api/new';
import { RequestBody } from '@opensearch-project/opensearch/lib/Transport';

import { Logger } from '../../logging';
Expand Down
1 change: 0 additions & 1 deletion src/core/server/opensearch/client/mocks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ describe('Mocked client', () => {
});

it('nested level API methods should be mocked', () => {
expectMocked(client.asyncSearch.get);
expectMocked(client.nodes.info);
});

Expand Down
6 changes: 3 additions & 3 deletions src/core/server/opensearch/client/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
import { Client, ApiResponse } from '@opensearch-project/opensearch';
import { Client, ApiResponse } from '@opensearch-project/opensearch/api/new';
import { TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport';
import { OpenSearchClient } from './types';
import { ICustomClusterClient } from './cluster_client';
Expand Down Expand Up @@ -176,9 +176,9 @@ const createErrorTransportRequestPromise = (err: any): MockedTransportRequestPro
return promise as MockedTransportRequestPromise<never>;
};

function createApiResponse(opts: Partial<ApiResponse> = {}): ApiResponse {
function createApiResponse<TResponse = Record<string, any>>(opts: Partial<ApiResponse> = {}): ApiResponse<TResponse> {
return {
body: {},
body: {} as any,
statusCode: 200,
headers: {},
warnings: [],
Expand Down
313 changes: 0 additions & 313 deletions src/core/server/opensearch/client/retry_call_cluster.test.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe('pollOpenSearchNodesVersion', () => {
internalClient.nodes.info.mockImplementationOnce(() => createOpenSearchError(error));
};

it('returns iscCompatible=false and keeps polling when a poll request throws', (done) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch

it('returns isCompatible=false and keeps polling when a poll request throws', (done) => {
expect.assertions(3);
const expectedCompatibilityResults = [false, false, true];
jest.clearAllMocks();
Expand Down
Loading