Skip to content

Commit

Permalink
[Deprecation] Deprecate the apiVersion: master value and replace with…
Browse files Browse the repository at this point in the history
… main

Resolves issue - opensearch-project#1687

Signed-off-by: Manasvini B Suryanarayana <[email protected]>
  • Loading branch information
manasvinibs committed Jun 27, 2022
1 parent 6ad5d08 commit b71c89e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const createStartContractMock = () => {
new BehaviorSubject<CoreUsageData>({
config: {
opensearch: {
apiVersion: 'master',
apiVersion: 'main',
customHeadersConfigured: false,
healthCheckDelayMs: 2500,
logQueries: false,
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/opensearch/legacy/cluster_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const logger = loggingSystemMock.create();
afterEach(() => jest.clearAllMocks());

test('#constructor creates client with parsed config', () => {
const mockOpenSearchClientConfig = { apiVersion: 'opensearch-client-master' };
const mockOpenSearchClientConfig = { apiVersion: 'opensearch-client-main' };
mockParseOpenSearchClientConfig.mockReturnValue(mockOpenSearchClientConfig);

const mockOpenSearchConfig = { apiVersion: 'opensearch-version' } as any;
Expand Down
18 changes: 10 additions & 8 deletions src/core/server/opensearch/legacy/opensearch_client_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@ test('parses minimally specified config', () => {
expect(
parseOpenSearchClientConfig(
{
apiVersion: 'master',
apiVersion: 'main',
customHeaders: { xsrf: 'something' },
logQueries: false,
sniffOnStart: false,
sniffOnConnectionFault: false,
hosts: ['http://localhost/opensearch'],
requestHeadersWhitelist: [],
},

logger.get()
)
).toMatchInlineSnapshot(`
Object {
"apiVersion": "master",
"apiVersion": "main",
"hosts": Array [
Object {
"headers": Object {
Expand Down Expand Up @@ -180,7 +181,7 @@ test('parses config timeouts of moment.Duration type', () => {
expect(
parseOpenSearchClientConfig(
{
apiVersion: 'master',
apiVersion: 'main',
customHeaders: { xsrf: 'something' },
logQueries: false,
sniffOnStart: false,
Expand All @@ -191,11 +192,12 @@ test('parses config timeouts of moment.Duration type', () => {
hosts: ['http://localhost:9200/opensearch'],
requestHeadersWhitelist: [],
},

logger.get()
)
).toMatchInlineSnapshot(`
Object {
"apiVersion": "master",
"apiVersion": "main",
"hosts": Array [
Object {
"headers": Object {
Expand Down Expand Up @@ -359,7 +361,7 @@ describe('#customHeaders', () => {
const headerKey = Object.keys(DEFAULT_HEADERS)[0];
const parsedConfig = parseOpenSearchClientConfig(
{
apiVersion: 'master',
apiVersion: 'main',
customHeaders: { [headerKey]: 'foo' },
logQueries: false,
sniffOnStart: false,
Expand All @@ -379,7 +381,7 @@ describe('#log', () => {
test('default logger with #logQueries = false', () => {
const parsedConfig = parseOpenSearchClientConfig(
{
apiVersion: 'master',
apiVersion: 'main',
customHeaders: { xsrf: 'something' },
logQueries: false,
sniffOnStart: false,
Expand Down Expand Up @@ -423,7 +425,7 @@ describe('#log', () => {
test('default logger with #logQueries = true', () => {
const parsedConfig = parseOpenSearchClientConfig(
{
apiVersion: 'master',
apiVersion: 'main',
customHeaders: { xsrf: 'something' },
logQueries: true,
sniffOnStart: false,
Expand Down Expand Up @@ -482,7 +484,7 @@ describe('#log', () => {

const parsedConfig = parseOpenSearchClientConfig(
{
apiVersion: 'master',
apiVersion: 'main',
customHeaders: { xsrf: 'something' },
logQueries: true,
sniffOnStart: false,
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/opensearch/opensearch_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export class OpenSearchConfig {
public readonly ignoreVersionMismatch: boolean;

/**
* Version of the OpenSearch (6.7, 7.1 or `master`) client will be connecting to.
* Version of the OpenSearch (6.7, 7.1 or `main`) client will be connecting to.
*/
public readonly apiVersion: string;

Expand Down

0 comments on commit b71c89e

Please sign in to comment.