-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Migrate /diagnostics and /service_nodes to be deployment agnostic #199645
Merged
miloszmarcinkowski
merged 16 commits into
elastic:main
from
miloszmarcinkowski:198967-apm-migrate-testapm_api_integrationtestsdiagnostics-to-be-deployment-agnostic-api-tests
Nov 14, 2024
Merged
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
30d377a
Migrate /test/apm_api_integration/tests/diagnostics to be deployment-…
miloszmarcinkowski 11c847e
Merge remote-tracking branch 'upstream/main' into 198967-apm-migrate-…
miloszmarcinkowski fefc157
Merge remote-tracking branch 'upstream/main' into 198967-apm-migrate-…
miloszmarcinkowski 3f29f99
unskip tests
miloszmarcinkowski b2d307a
filter out apm index templates
miloszmarcinkowski dd0a870
type check fix
miloszmarcinkowski 9e7b6fe
Merge remote-tracking branch 'upstream/main' into 198967-apm-migrate-…
miloszmarcinkowski 11ce02a
Migrate /test/apm_api_integration/tests/service_nodes to be deploymen…
miloszmarcinkowski 8f8ef6c
Merge branch '198985-apm-migrate-testapm_api_integrationtestsservice_…
miloszmarcinkowski ec4c5cc
Correct describe block title
miloszmarcinkowski b9a4a03
Merge branch 'main' into 198967-apm-migrate-testapm_api_integrationte…
miloszmarcinkowski 2bd7dae
remove duplicated apm package instalation
miloszmarcinkowski 28c1ba6
convert to Type-Only imports in `apm/*` tests
miloszmarcinkowski 7a56f8c
adjust index_pattern_settings.spec.ts to work in all testing environm…
miloszmarcinkowski 50d8fba
Merge remote-tracking branch 'upstream/main' into 198967-apm-migrate-…
miloszmarcinkowski 2e2d110
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
19 changes: 19 additions & 0 deletions
19
x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/diagnostics/index.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,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context'; | ||
|
||
export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext) { | ||
describe('diagnostics', () => { | ||
loadTestFile(require.resolve('./apm_events.spec.ts')); | ||
loadTestFile(require.resolve('./data_streams.spec.ts')); | ||
loadTestFile(require.resolve('./index_pattern_settings.spec.ts')); | ||
loadTestFile(require.resolve('./index_templates.spec.ts')); | ||
loadTestFile(require.resolve('./indices.spec.ts')); | ||
loadTestFile(require.resolve('./privileges.spec.ts')); | ||
}); | ||
} |
108 changes: 108 additions & 0 deletions
108
...ion/deployment_agnostic/apis/observability/apm/diagnostics/index_pattern_settings.spec.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,108 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { apm, timerange } from '@kbn/apm-synthtrace-client'; | ||
import type { ApmSynthtraceEsClient } from '@kbn/apm-synthtrace'; | ||
import { uniq } from 'lodash'; | ||
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context'; | ||
|
||
export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) { | ||
const apmApiClient = getService('apmApi'); | ||
const synthtrace = getService('synthtrace'); | ||
|
||
const start = new Date('2021-01-01T00:00:00.000Z').getTime(); | ||
const end = new Date('2021-01-01T00:15:00.000Z').getTime() - 1; | ||
|
||
describe('Diagnostics: Index pattern settings', () => { | ||
describe('When data is ingested', () => { | ||
let apmSynthtraceEsClient: ApmSynthtraceEsClient; | ||
|
||
before(async () => { | ||
apmSynthtraceEsClient = await synthtrace.createApmSynthtraceEsClient(); | ||
|
||
const instance = apm | ||
.service({ name: 'synth-go', environment: 'production', agentName: 'go' }) | ||
.instance('instance-a'); | ||
await apmSynthtraceEsClient.index( | ||
timerange(start, end) | ||
.interval('1m') | ||
.rate(30) | ||
.generator((timestamp) => | ||
instance | ||
.transaction({ transactionName: 'GET /users' }) | ||
.timestamp(timestamp) | ||
.duration(100) | ||
.success() | ||
) | ||
); | ||
}); | ||
|
||
after(() => apmSynthtraceEsClient.clean()); | ||
|
||
it('returns APM index templates', async () => { | ||
const apmIndexTemplatesPatterns = ['apm', 'otel']; | ||
|
||
const { status, body } = await apmApiClient.adminUser({ | ||
endpoint: 'GET /internal/apm/diagnostics', | ||
}); | ||
expect(status).to.be(200); | ||
|
||
// filtering the array for unique index templates because they get duplicated across different index patterns | ||
const uniqueTemplateNames = uniq( | ||
body.indexTemplatesByIndexPattern.flatMap(({ indexTemplates }) => { | ||
return indexTemplates?.map(({ templateName }) => templateName); | ||
}) | ||
); | ||
|
||
// filter only APM releated indices | ||
const apmTemplateNames = uniqueTemplateNames.filter( | ||
(templateName) => | ||
templateName.endsWith('@template') && | ||
apmIndexTemplatesPatterns.some((pattern) => templateName.includes(pattern)) | ||
); | ||
|
||
// sort alphabeticaly before comparing because an order is different between testing environments | ||
const sortedApmTemplates = apmTemplateNames.sort(); | ||
|
||
expect(sortedApmTemplates).to.eql([ | ||
'logs-apm.app@template', | ||
'logs-apm.error@template', | ||
'logs-otel@template', | ||
'metrics-apm.app@template', | ||
'metrics-apm.internal@template', | ||
'metrics-apm.service_destination.10m@template', | ||
'metrics-apm.service_destination.1m@template', | ||
'metrics-apm.service_destination.60m@template', | ||
'metrics-apm.service_summary.10m@template', | ||
'metrics-apm.service_summary.1m@template', | ||
'metrics-apm.service_summary.60m@template', | ||
'metrics-apm.service_transaction.10m@template', | ||
'metrics-apm.service_transaction.1m@template', | ||
'metrics-apm.service_transaction.60m@template', | ||
'metrics-apm.transaction.10m@template', | ||
'metrics-apm.transaction.1m@template', | ||
'metrics-apm.transaction.60m@template', | ||
'metrics-otel@template', | ||
'metrics-service_summary.10m.otel@template', | ||
'metrics-service_summary.1m.otel@template', | ||
'metrics-service_summary.60m.otel@template', | ||
'metrics-service_transaction.10m.otel@template', | ||
'metrics-service_transaction.1m.otel@template', | ||
'metrics-service_transaction.60m.otel@template', | ||
'metrics-transaction.10m.otel@template', | ||
'metrics-transaction.1m.otel@template', | ||
'metrics-transaction.60m.otel@template', | ||
'traces-apm.rum@template', | ||
'traces-apm.sampled@template', | ||
'traces-apm@template', | ||
'traces-otel@template', | ||
]); | ||
}); | ||
}); | ||
}); | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When default index templates are deleted, they get recreated automatically. Introduced here: elastic/elasticsearch#97546
This means we can't perform check against empty response anymore.