-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
68 changes: 68 additions & 0 deletions
68
x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.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,68 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { tasks } from './tasks'; | ||
import { ApmIndicesConfig } from '../../settings/apm_indices/get_apm_indices'; | ||
|
||
describe('data telemetry collection tasks', () => { | ||
const indices = { | ||
'apm_oss.errorIndices': 'apm-8.0.0-error', | ||
'apm_oss.metricsIndices': 'apm-8.0.0-metric', | ||
'apm_oss.spanIndices': 'apm-8.0.0-span', | ||
'apm_oss.transactionIndices': 'apm-8.0.0-transaction', | ||
} as ApmIndicesConfig; | ||
|
||
describe('cloud', () => { | ||
const cloudTask = tasks.find((task) => task.name === 'cloud'); | ||
|
||
it('returns a map of cloud provider data', async () => { | ||
const search = jest.fn().mockResolvedValueOnce({ | ||
aggregations: { | ||
availability_zone: { | ||
buckets: [ | ||
{ doc_count: 1, key: 'us-west-1' }, | ||
{ doc_count: 1, key: 'europe-west1-c' }, | ||
], | ||
}, | ||
provider: { | ||
buckets: [ | ||
{ doc_count: 1, key: 'aws' }, | ||
{ doc_count: 1, key: 'gcp' }, | ||
], | ||
}, | ||
region: { | ||
buckets: [ | ||
{ doc_count: 1, key: 'us-west' }, | ||
{ doc_count: 1, key: 'europe-west1' }, | ||
], | ||
}, | ||
}, | ||
}); | ||
|
||
expect(await cloudTask?.executor({ indices, search } as any)).toEqual({ | ||
cloud: { | ||
availability_zone: ['us-west-1', 'europe-west1-c'], | ||
provider: ['aws', 'gcp'], | ||
region: ['us-west', 'europe-west1'], | ||
}, | ||
}); | ||
}); | ||
|
||
describe('with no results', () => { | ||
it('returns an empty map', async () => { | ||
const search = jest.fn().mockResolvedValueOnce({}); | ||
|
||
expect(await cloudTask?.executor({ indices, search } as any)).toEqual({ | ||
cloud: { | ||
availability_zone: [], | ||
provider: [], | ||
region: [], | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
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