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

[Fleet] Migrate ES client #92805

Merged
merged 42 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2d00471
Migrate `deletePipeline` to new ESclient
Feb 25, 2021
0b52acc
Migrate `installILMPolicy` to new client
Feb 25, 2021
b6af091
Remove dead function
Feb 25, 2021
c3add82
Migrate `deleteIlms` to new client
Feb 25, 2021
75be7c2
Migrate `deleteTemplate` to new client
Feb 25, 2021
f8ca0f3
Migrate `deleteTransports` to new client
Feb 25, 2021
5e553a0
Remove old client from `deleteAssets`
Feb 25, 2021
2c17bf8
Remove old client from `removeInstallation`
Feb 25, 2021
2e02613
Migrate `updateCurrentWriteIndices` to new client
Feb 25, 2021
1c1a9d5
Remove old client from `installTransform`
Feb 25, 2021
cf61b1f
Migrate `installTemplates` to new client
Feb 25, 2021
63a9634
Migrate `installPipelines` to new client
Feb 25, 2021
dbf08af
Migrate `installIlmForDataStream` to new client
Feb 25, 2021
82b5955
Remove old client from `installPackage`
Feb 25, 2021
56b4ad1
Remove old client from `bulkInstallPackages`
Feb 25, 2021
d842493
Remove legacy client from `ensurePackagesCompletedInstall`
Feb 25, 2021
95db78c
Remove legacy client from `addPackageToAgentPolicy`
Feb 25, 2021
a31a6d7
Migrate `setupIngestManager` to new client
Feb 25, 2021
59536b5
Fix types inside `createSetupSideEffects`
Feb 25, 2021
82270f7
Fix failing jest tests
Mar 1, 2021
a797237
Properly handle `resource_already_exists_exception` errors
Mar 1, 2021
8401da6
Cleanup test file
Mar 1, 2021
3ecbde6
Remove dead function
Mar 2, 2021
14f1965
Migrate `getListHandler` to new client
Mar 2, 2021
8ddaf75
Use `putIndexTemplate` method
Mar 2, 2021
b304493
Use `ingest.putPipeline` method
Mar 2, 2021
c075e85
Use `cluster.putComponentTemplate`
Mar 2, 2021
8cbb052
Cleanup references
Mar 2, 2021
d27cecc
Merge branch 'master' into 74111-migrate-es-client
kibanamachine Mar 2, 2021
09d5836
Handle v1 templates
Mar 2, 2021
32f4ca8
Use specific index template API methods
Mar 2, 2021
93a7a28
Use specific data stream API methods
Mar 2, 2021
8e850a3
Use specific security API methods
Mar 2, 2021
9b34fc7
Use specific transform API methods
Mar 2, 2021
fae1df1
Fix tests
Mar 2, 2021
b5f73c3
Fix installTemplat tests
Mar 3, 2021
0198e02
Merge branch 'master' into 74111-migrate-es-client
Mar 3, 2021
f6f094a
Merge branch 'master' into 74111-migrate-es-client
kibanamachine Mar 3, 2021
fabd93e
Run `node scripts/build_api_docs` locally to try to fix the build
Mar 3, 2021
d5f4f02
Merge branch 'master' into 74111-migrate-es-client
kibanamachine Mar 3, 2021
9df6b37
Merge branch 'master' into 74111-migrate-es-client
Mar 8, 2021
c6c3c0a
Merge branch 'master' into 74111-migrate-es-client
Mar 8, 2021
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 @@ -12,15 +12,16 @@ import { elasticsearchServiceMock } from 'src/core/server/mocks';
import { installTemplate } from './install';

test('tests installPackage to use correct priority and index_patterns for data stream with dataset_is_prefix not set', async () => {
const callCluster = elasticsearchServiceMock.createLegacyScopedClusterClient().callAsCurrentUser;
callCluster.mockImplementation(async (_, params) => {
const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser;
esClient.transport.request.mockImplementation((params) => {
if (
params &&
params.method === 'GET' &&
params.path === '/_index_template/metrics-package.dataset'
) {
return { index_templates: [] };
return elasticsearchServiceMock.createSuccessTransportRequestPromise({ index_templates: [] });
}
return elasticsearchServiceMock.createSuccessTransportRequestPromise({});
});

const fields: Field[] = [];
Expand All @@ -40,7 +41,7 @@ test('tests installPackage to use correct priority and index_patterns for data s
const templateIndexPatternDatasetIsPrefixUnset = 'metrics-package.dataset-*';
const templatePriorityDatasetIsPrefixUnset = 200;
await installTemplate({
callCluster,
esClient,
fields,
dataStream: dataStreamDatasetIsPrefixUnset,
packageVersion: pkg.version,
Expand All @@ -54,15 +55,16 @@ test('tests installPackage to use correct priority and index_patterns for data s
});

test('tests installPackage to use correct priority and index_patterns for data stream with dataset_is_prefix set to false', async () => {
const callCluster = elasticsearchServiceMock.createLegacyScopedClusterClient().callAsCurrentUser;
callCluster.mockImplementation(async (_, params) => {
const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser;
esClient.transport.request.mockImplementation((params) => {
if (
params &&
params.method === 'GET' &&
params.path === '/_index_template/metrics-package.dataset'
) {
return { index_templates: [] };
return elasticsearchServiceMock.createSuccessTransportRequestPromise({ index_templates: [] });
}
return elasticsearchServiceMock.createSuccessTransportRequestPromise({});
});

const fields: Field[] = [];
Expand All @@ -83,7 +85,7 @@ test('tests installPackage to use correct priority and index_patterns for data s
const templateIndexPatternDatasetIsPrefixFalse = 'metrics-package.dataset-*';
const templatePriorityDatasetIsPrefixFalse = 200;
await installTemplate({
callCluster,
esClient,
fields,
dataStream: dataStreamDatasetIsPrefixFalse,
packageVersion: pkg.version,
Expand All @@ -97,15 +99,16 @@ test('tests installPackage to use correct priority and index_patterns for data s
});

test('tests installPackage to use correct priority and index_patterns for data stream with dataset_is_prefix set to true', async () => {
const callCluster = elasticsearchServiceMock.createLegacyScopedClusterClient().callAsCurrentUser;
callCluster.mockImplementation(async (_, params) => {
const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser;
esClient.transport.request.mockImplementation((params) => {
if (
params &&
params.method === 'GET' &&
params.path === '/_index_template/metrics-package.dataset'
) {
return { index_templates: [] };
return elasticsearchServiceMock.createSuccessTransportRequestPromise({ index_templates: [] });
}
return elasticsearchServiceMock.createSuccessTransportRequestPromise({});
});

const fields: Field[] = [];
Expand All @@ -126,7 +129,7 @@ test('tests installPackage to use correct priority and index_patterns for data s
const templateIndexPatternDatasetIsPrefixTrue = 'metrics-package.dataset.*-*';
const templatePriorityDatasetIsPrefixTrue = 150;
await installTemplate({
callCluster,
esClient,
fields,
dataStream: dataStreamDatasetIsPrefixTrue,
packageVersion: pkg.version,
Expand All @@ -140,14 +143,14 @@ test('tests installPackage to use correct priority and index_patterns for data s
});

test('tests installPackage remove the aliases property if the property existed', async () => {
const callCluster = elasticsearchServiceMock.createLegacyScopedClusterClient().callAsCurrentUser;
callCluster.mockImplementation(async (_, params) => {
const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser;
esClient.transport.request.mockImplementation((params) => {
if (
params &&
params.method === 'GET' &&
params.path === '/_index_template/metrics-package.dataset'
) {
return {
return elasticsearchServiceMock.createSuccessTransportRequestPromise({
index_templates: [
{
name: 'metrics-package.dataset',
Expand All @@ -157,8 +160,9 @@ test('tests installPackage remove the aliases property if the property existed',
},
},
],
};
});
}
return elasticsearchServiceMock.createSuccessTransportRequestPromise({});
});

const fields: Field[] = [];
Expand All @@ -178,7 +182,7 @@ test('tests installPackage remove the aliases property if the property existed',
const templateIndexPatternDatasetIsPrefixUnset = 'metrics-package.dataset-*';
const templatePriorityDatasetIsPrefixUnset = 200;
await installTemplate({
callCluster,
esClient,
fields,
dataStream: dataStreamDatasetIsPrefixUnset,
packageVersion: pkg.version,
Expand Down
Loading