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

[Infra] API tests deployment agnostic #198257

Merged

Conversation

crespocarlos
Copy link
Contributor

@crespocarlos crespocarlos commented Oct 30, 2024

closes #198015

Summary

Migrate most of the infra APIs integration tests to the deployment-agnostic approach.

Important

  • Metrics UI related tests were note migrated because the feature is not enabled on serverless.
  • Host with active alerts test was not migrated because es_archiver fails to load the alerts data. This is because on serverless, the alerts indices are created as managed data streams and that causes the es_archiver to fail. We should probably try use synthtrace.
  • Tested against MKI
  • Tested against stateful

@crespocarlos crespocarlos changed the title 198015 infra api tests agnostic [Infra] API tests deployment agnostic Oct 30, 2024
@crespocarlos crespocarlos force-pushed the 198015-infra-api-tests-agnostic branch 2 times, most recently from 8df3c3f to 69efed3 Compare October 30, 2024 11:09
@crespocarlos crespocarlos force-pushed the 198015-infra-api-tests-agnostic branch from 69efed3 to 6701b34 Compare October 30, 2024 11:14
@crespocarlos
Copy link
Contributor Author

@elasticmachine merge upstream

@crespocarlos crespocarlos force-pushed the 198015-infra-api-tests-agnostic branch 3 times, most recently from 843e154 to 865ad7a Compare November 1, 2024 10:40
@crespocarlos crespocarlos force-pushed the 198015-infra-api-tests-agnostic branch from 865ad7a to efe6a2e Compare November 1, 2024 13:33
@crespocarlos
Copy link
Contributor Author

/ci

@crespocarlos
Copy link
Contributor Author

@elasticmachine merge upstream

@crespocarlos
Copy link
Contributor Author

/ci

Comment on lines +130 to 154
describe('GET /api/metrics/source/{sourceId}', () => {
it('should just work', async () => {
const { body } = await supertestWithAdminScope
.get('/api/metrics/source/default')
.set('kbn-xsrf', 'xxx')
.send({ name: 'NAME', anomalyThreshold: 20 })
.expect(200);

await supertest
.patch(`${SOURCE_API_URL}/${SOURCE_ID}`)
.set('kbn-xsrf', 'xxx')
.send({ anomalyThreshold: -2 })
.expect(400);
await supertest
.patch(`${SOURCE_API_URL}/${SOURCE_ID}`)
.set('kbn-xsrf', 'xxx')
.send({ anomalyThreshold: 101 })
.expect(400);
expect(body).to.have.property('source');
expect(body?.source.configuration.metricAlias).to.equal('metrics-*,metricbeat-*');
expect(body?.source).to.have.property('status');
expect(body?.source.status?.metricIndicesExist).to.equal(true);
});
});

describe('GET /api/metrics/source/{sourceId}/hasData', () => {
it('should just work', async () => {
const { body } = await supertestWithAdminScope
.get(`/api/metrics/source/default/hasData`)

.expect(200);

expect(body).to.have.property('hasData');
expect(body?.hasData).to.be(true);
});
});
Copy link
Contributor Author

@crespocarlos crespocarlos Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merged with http_source.ts

@@ -1341,5 +1344,119 @@ export default function ({ getService }: FtrProviderContext) {
});
});
});
describe('getElasticsearchMetricQuery', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged with metrics_alerting.ts

@crespocarlos crespocarlos added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team labels Nov 4, 2024
Copy link
Contributor

github-actions bot commented Nov 4, 2024

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Member

@dmlemeshko dmlemeshko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! LGTM

Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crespocarlos
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

There are no new commits on the base branch.

@crespocarlos
Copy link
Contributor Author

@elasticmachine merge upstream

@crespocarlos
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 4, 2024

💚 Build Succeeded

  • Buildkite Build
  • Commit: c567ce1
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-198257-c567ce102932

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/apm-synthtrace 86 87 +1
Unknown metric groups

API count

id before after diff
@kbn/apm-synthtrace 86 87 +1

History

Copy link
Member

@weltenwort weltenwort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logs UI test changes LGTM, thank you!

@@ -21,7 +21,6 @@ export default createTestConfig({
services,
// add feature flags
kbnServerArgs: [
'--xpack.infra.enabled=true',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Giving the 👍🏾 as I'm not sure why security solution is a code owner for an observability file? @crespocarlos .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crespocarlos crespocarlos merged commit 26f24c6 into elastic:main Nov 5, 2024
25 checks passed
@crespocarlos crespocarlos deleted the 198015-infra-api-tests-agnostic branch November 5, 2024 18:40
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11690507433

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 198257

Questions ?

Please refer to the Backport tool documentation

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 198257 locally

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Nov 6, 2024
mgadewoll pushed a commit to mgadewoll/kibana that referenced this pull request Nov 7, 2024
closes [elastic#198015](elastic#198015)

## Summary

Migrate most of the infra APIs integration tests to the
deployment-agnostic approach.

>[!important]
> - Metrics UI related tests were note migrated because the feature is
not enabled on serverless.
> - `Host with active alerts` test was not migrated because
`es_archiver` fails to load the alerts data. This is because on
serverless, the alerts indices are created as managed data streams and
that causes the `es_archiver` to fail. We should probably try use
synthtrace.

 - [x] Tested against MKI
 - [x] Tested against stateful

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 198257 locally

1 similar comment
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 198257 locally

crespocarlos added a commit to crespocarlos/kibana that referenced this pull request Nov 11, 2024
closes [elastic#198015](elastic#198015)

## Summary

Migrate most of the infra APIs integration tests to the
deployment-agnostic approach.

>[!important]
> - Metrics UI related tests were note migrated because the feature is
not enabled on serverless.
> - `Host with active alerts` test was not migrated because
`es_archiver` fails to load the alerts data. This is because on
serverless, the alerts indices are created as managed data streams and
that causes the `es_archiver` to fail. We should probably try use
synthtrace.

 - [x] Tested against MKI
 - [x] Tested against stateful

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit 26f24c6)

# Conflicts:
#	.github/CODEOWNERS
#	packages/kbn-apm-synthtrace/src/lib/apm/client/apm_synthtrace_kibana_client.ts
#	x-pack/test_serverless/api_integration/test_suites/observability/config.feature_flags.ts
#	x-pack/test_serverless/api_integration/test_suites/observability/index.feature_flags.ts
#	x-pack/test_serverless/tsconfig.json
crespocarlos added a commit that referenced this pull request Nov 11, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Infra] API tests deployment agnostic
(#198257)](#198257)

<!--- Backport version: 8.9.8 -->

### 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-05T18:39:58Z","message":"[Infra]
API tests deployment agnostic (#198257)\n\ncloses
[#198015](https://github.com/elastic/kibana/issues/198015)\r\n\r\n##
Summary\r\n\r\nMigrate most of the infra APIs integration tests to
the\r\ndeployment-agnostic approach.\r\n\r\n>[!important]\r\n> - Metrics
UI related tests were note migrated because the feature is\r\nnot
enabled on serverless.\r\n> - `Host with active alerts` test was not
migrated because\r\n`es_archiver` fails to load the alerts data. This is
because on\r\nserverless, the alerts indices are created as managed data
streams and\r\nthat causes the `es_archiver` to fail. We should probably
try use\r\nsynthtrace.\r\n\r\n - [x] Tested against MKI\r\n - [x] Tested
against stateful\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"26f24c66b5843f5d2c4340dd442c4ddfd375793f","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"number":198257,"url":"https://github.com/elastic/kibana/pull/198257","mergeCommit":{"message":"[Infra]
API tests deployment agnostic (#198257)\n\ncloses
[#198015](https://github.com/elastic/kibana/issues/198015)\r\n\r\n##
Summary\r\n\r\nMigrate most of the infra APIs integration tests to
the\r\ndeployment-agnostic approach.\r\n\r\n>[!important]\r\n> - Metrics
UI related tests were note migrated because the feature is\r\nnot
enabled on serverless.\r\n> - `Host with active alerts` test was not
migrated because\r\n`es_archiver` fails to load the alerts data. This is
because on\r\nserverless, the alerts indices are created as managed data
streams and\r\nthat causes the `es_archiver` to fail. We should probably
try use\r\nsynthtrace.\r\n\r\n - [x] Tested against MKI\r\n - [x] Tested
against stateful\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"26f24c66b5843f5d2c4340dd442c4ddfd375793f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198257","number":198257,"mergeCommit":{"message":"[Infra]
API tests deployment agnostic (#198257)\n\ncloses
[#198015](https://github.com/elastic/kibana/issues/198015)\r\n\r\n##
Summary\r\n\r\nMigrate most of the infra APIs integration tests to
the\r\ndeployment-agnostic approach.\r\n\r\n>[!important]\r\n> - Metrics
UI related tests were note migrated because the feature is\r\nnot
enabled on serverless.\r\n> - `Host with active alerts` test was not
migrated because\r\n`es_archiver` fails to load the alerts data. This is
because on\r\nserverless, the alerts indices are created as managed data
streams and\r\nthat causes the `es_archiver` to fail. We should probably
try use\r\nsynthtrace.\r\n\r\n - [x] Tested against MKI\r\n - [x] Tested
against stateful\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"26f24c66b5843f5d2c4340dd442c4ddfd375793f"}}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <[email protected]>
@kibanamachine kibanamachine added v8.17.0 and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Infra] Deployment-agnostic API tests
7 participants