Skip to content

Commit

Permalink
[8.x] [APM] Revert deletion of service agent test (#200196) (#200535)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[APM] Revert deletion of service agent test
(#200196)](#200196)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Carlos
Crespo","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-18T10:46:22Z","message":"[APM]
Revert deletion of service agent test (#200196)\n\nCloses
https://github.com/elastic/kibana/issues/198988\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\n##
Summary\r\n\r\nFollow up from
#199812. The\r\n`agent.spec.ts`
test was deleted by mistake.\r\n\r\n### How to test\r\n\r\n-
Serverless\r\n\r\n```\r\nnode scripts/functional_tests_server --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts
--grep=\"APM\"\r\n```\r\n\r\nIt's recommended to be run
against\r\n[MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki)\r\n\r\n-
Stateful\r\n```\r\nnode scripts/functional_tests_server --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts
--grep=\"APM\"\r\n```\r\n\r\n- [ ] ~(OPTIONAL, only if a test has been
unskipped) Run flaky test\r\nsuite~\r\n- [x] local run for
serverless\r\n- [x] local run for stateful\r\n- [x] MKI run for
serverless\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"c473a69afc44d61007ba883b03179d28173d0a47","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"title":"[APM]
Revert deletion of service agent
test","number":200196,"url":"https://github.com/elastic/kibana/pull/200196","mergeCommit":{"message":"[APM]
Revert deletion of service agent test (#200196)\n\nCloses
https://github.com/elastic/kibana/issues/198988\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\n##
Summary\r\n\r\nFollow up from
#199812. The\r\n`agent.spec.ts`
test was deleted by mistake.\r\n\r\n### How to test\r\n\r\n-
Serverless\r\n\r\n```\r\nnode scripts/functional_tests_server --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts
--grep=\"APM\"\r\n```\r\n\r\nIt's recommended to be run
against\r\n[MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki)\r\n\r\n-
Stateful\r\n```\r\nnode scripts/functional_tests_server --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts
--grep=\"APM\"\r\n```\r\n\r\n- [ ] ~(OPTIONAL, only if a test has been
unskipped) Run flaky test\r\nsuite~\r\n- [x] local run for
serverless\r\n- [x] local run for stateful\r\n- [x] MKI run for
serverless\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"c473a69afc44d61007ba883b03179d28173d0a47"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200196","number":200196,"mergeCommit":{"message":"[APM]
Revert deletion of service agent test (#200196)\n\nCloses
https://github.com/elastic/kibana/issues/198988\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\n##
Summary\r\n\r\nFollow up from
#199812. The\r\n`agent.spec.ts`
test was deleted by mistake.\r\n\r\n### How to test\r\n\r\n-
Serverless\r\n\r\n```\r\nnode scripts/functional_tests_server --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts
--grep=\"APM\"\r\n```\r\n\r\nIt's recommended to be run
against\r\n[MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki)\r\n\r\n-
Stateful\r\n```\r\nnode scripts/functional_tests_server --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts
--grep=\"APM\"\r\n```\r\n\r\n- [ ] ~(OPTIONAL, only if a test has been
unskipped) Run flaky test\r\nsuite~\r\n- [x] local run for
serverless\r\n- [x] local run for stateful\r\n- [x] MKI run for
serverless\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"c473a69afc44d61007ba883b03179d28173d0a47"}}]}]
BACKPORT-->

Co-authored-by: Carlos Crespo <[email protected]>
  • Loading branch information
kibanamachine and crespocarlos authored Nov 18, 2024
1 parent 307acc7 commit db82fe5
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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 archives_metadata from '../../../../../../apm_api_integration/common/fixtures/es_archiver/archives_metadata';
import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provider_context';
import { ARCHIVER_ROUTES } from '../constants/archiver';

export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) {
const apmApiClient = getService('apmApi');
const esArchiver = getService('esArchiver');

const archiveName = '8.0.0';
const { start, end } = archives_metadata[archiveName];

describe('Agent name', () => {
describe('when data is not loaded', () => {
it('handles the empty state', async () => {
const response = await apmApiClient.readUser({
endpoint: 'GET /internal/apm/services/{serviceName}/agent',
params: {
path: { serviceName: 'opbeans-node' },
query: {
start,
end,
},
},
});

expect(response.status).to.be(200);
expect(response.body).to.eql({});
});
});

describe('when data is loaded', () => {
before(async () => {
await esArchiver.load(ARCHIVER_ROUTES[archiveName]);
});
after(async () => {
await esArchiver.unload(ARCHIVER_ROUTES[archiveName]);
});

it('returns the agent name', async () => {
const response = await apmApiClient.readUser({
endpoint: 'GET /internal/apm/services/{serviceName}/agent',
params: {
path: { serviceName: 'opbeans-node' },
query: {
start,
end,
},
},
});

expect(response.status).to.be(200);

expect(response.body).to.eql({ agentName: 'nodejs', runtimeName: 'node' });
});
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext)
loadTestFile(require.resolve('./error_groups/error_groups_main_statistics.spec.ts'));
loadTestFile(require.resolve('./service_details/service_details.spec.ts'));
loadTestFile(require.resolve('./service_icons/service_icons.spec.ts'));
loadTestFile(require.resolve('./agent.spec.ts'));
loadTestFile(require.resolve('./archive_services_detailed_statistics.spec.ts'));
loadTestFile(require.resolve('./derived_annotations.spec.ts'));
loadTestFile(require.resolve('./get_service_node_metadata.spec.ts'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
*/

export default {
'8.0.0': {
start: '2020-08-26T11:00:43.849Z',
end: '2020-08-26T12:00:43.849Z',
},
'apm_8.0.0': {
start: '2021-08-03T06:50:15.910Z',
end: '2021-08-03T07:20:15.910Z',
Expand Down

0 comments on commit db82fe5

Please sign in to comment.