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

[Backport 2.1] [Deprecation] Deprecate the apiVersion: master value and replace with main #1831

Merged
merged 1 commit into from
Jun 29, 2022
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
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 (1.1, 2.1 or `main`) client will be connecting to.
*/
public readonly apiVersion: string;

Expand Down