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

[APM] Migrate apm alerts tests to deployment agnostic #199097

Merged

Conversation

crespocarlos
Copy link
Contributor

@crespocarlos crespocarlos commented Nov 6, 2024

Summary

Closes #198959
Part of #193245

This PR contains the changes to migrate alerts test folder to Deployment-agnostic testing strategy.
It also fixes a bug when filtering alerts by kibana.alert.rule.producer. On serverless ,the producer is observability, not apm

How to test

  • Serverless
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts --grep="APM"

It's recommended to be run against MKI - This PR won't pass on MKI while the instance is not created using the kibana.alert.rule.producer fix from this PR

  • Stateful
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts --grep="APM"

@crespocarlos crespocarlos force-pushed the 198959-migrate-apm-alerts-tests branch from cb201c6 to f75d220 Compare November 6, 2024 09:55
@crespocarlos crespocarlos force-pushed the 198959-migrate-apm-alerts-tests branch 3 times, most recently from e6fb4a4 to 53a9373 Compare November 7, 2024 16:19
@crespocarlos crespocarlos changed the title 198959 migrate apm alerts tests [APM Migrate apm alerts tests to deployment agnostic Nov 7, 2024
@crespocarlos
Copy link
Contributor Author

/ci

@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 7, 2024
@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7348

[✅] x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts: 25/25 tests passed.

see run history

@crespocarlos crespocarlos force-pushed the 198959-migrate-apm-alerts-tests branch from 53a9373 to 1ef84ef Compare November 7, 2024 17:14
@crespocarlos
Copy link
Contributor Author

/ci

@crespocarlos crespocarlos changed the title [APM Migrate apm alerts tests to deployment agnostic [APM] Migrate apm alerts tests to deployment agnostic Nov 7, 2024
@crespocarlos crespocarlos force-pushed the 198959-migrate-apm-alerts-tests branch from 1ef84ef to 1f8c541 Compare November 8, 2024 09:13
@crespocarlos
Copy link
Contributor Author

/ci

@crespocarlos crespocarlos force-pushed the 198959-migrate-apm-alerts-tests branch from 1f8c541 to 670ee82 Compare November 8, 2024 10:48
@crespocarlos
Copy link
Contributor Author

/ci

@crespocarlos crespocarlos marked this pull request as ready for review November 8, 2024 11:31
@crespocarlos crespocarlos requested review from a team as code owners November 8, 2024 11:31
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@wayneseymour
Copy link
Member

👀

@crespocarlos
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@wayneseymour wayneseymour left a comment

Choose a reason for hiding this comment

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

Also, I would love to humbly request any codeowner updates for files added in this PR.
There is an on-going effort to have zero test files without an owner, in order to soon have much more granular reporting for teams.

Copy link
Contributor

@kpatticha kpatticha left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@wayneseymour wayneseymour left a comment

Choose a reason for hiding this comment

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

Looking better Carlos.
Just a few more mentions of supertest.
Again, in order to better protect our releases and for other teams to assist in test failure debugging, the ability to quickly distinguish which privileges are in play is crucial.

Copy link
Contributor

@MiriamAparicio MiriamAparicio left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@wayneseymour wayneseymour left a comment

Choose a reason for hiding this comment

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

We're almost there.

before(() => {
describe('transaction duration alert', () => {
let apmSynthtraceEsClient: ApmSynthtraceEsClient;
let supertestViewerWithCookieCredentials: SupertestWithRoleScopeType;
Copy link
Member

Choose a reason for hiding this comment

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

💟

@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 11, 2024

💚 Build Succeeded

  • Buildkite Build
  • Commit: 3a56a72
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-199097-3a56a72fc4d7

Metrics [docs]

✅ unchanged

History

Copy link
Member

@wayneseymour wayneseymour left a comment

Choose a reason for hiding this comment

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

CR only, LGTM

@crespocarlos crespocarlos merged commit fb666aa into elastic:main Nov 12, 2024
24 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

@kibanamachine
Copy link
Contributor

💔 All backports failed

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

You might need to backport the following PRs to 8.x:
- [APM] Migrate /data_view to deployment agnostic test (#199296)
- [APM] Migrate /mobile API tests to deployment agnostic folder (#199021)

Manual backport

To create the backport manually run:

node scripts/backport --pr 199097

Questions ?

Please refer to the Backport tool documentation

crespocarlos added a commit to crespocarlos/kibana that referenced this pull request Nov 12, 2024
## Summary

Closes [elastic#198959](elastic#198959)
Part of elastic#193245

This PR contains the changes to migrate `alerts` test folder to
Deployment-agnostic testing strategy.
It also fixes a bug when filtering alerts by
`kibana.alert.rule.producer`. On serverless ,the producer is
`observability`, not `apm`

### How to test

- Serverless

```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts --grep="APM"
```

It's recommended to be run against
[MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki)
- This PR won't pass on MKI while the instance is not created using the
`kibana.alert.rule.producer` fix from this PR

- Stateful
```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts --grep="APM"
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit fb666aa)

# Conflicts:
#	.github/CODEOWNERS
#	x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/index.ts
crespocarlos added a commit to crespocarlos/kibana that referenced this pull request Nov 12, 2024
## Summary

Closes [elastic#198959](elastic#198959)
Part of elastic#193245

This PR contains the changes to migrate `alerts` test folder to
Deployment-agnostic testing strategy.
It also fixes a bug when filtering alerts by
`kibana.alert.rule.producer`. On serverless ,the producer is
`observability`, not `apm`

### How to test

- Serverless

```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts --grep="APM"
```

It's recommended to be run against
[MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki)
- This PR won't pass on MKI while the instance is not created using the
`kibana.alert.rule.producer` fix from this PR

- Stateful
```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts --grep="APM"
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@crespocarlos
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

crespocarlos added a commit that referenced this pull request Nov 12, 2024
…#199781)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[APM] Migrate apm alerts tests to deployment agnostic
(#199097)](#199097)

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

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

<!--BACKPORT [{"author":{"name":"Carlos
Crespo","email":"crespocarlos@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-11-12T11:01:23Z","message":"[APM]
Migrate apm alerts tests to deployment agnostic (#199097)\n\n##
Summary\r\n\r\nCloses
[#198959](https://github.com/elastic/kibana/issues/198959)\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\nThis PR contains
the changes to migrate `alerts` test folder to\r\nDeployment-agnostic
testing strategy.\r\nIt also fixes a bug when filtering alerts
by\r\n`kibana.alert.rule.producer`. On serverless ,the producer
is\r\n`observability`, not `apm`\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-
This PR won't pass on MKI while the instance is not created using
the\r\n`kibana.alert.rule.producer` fix from this PR\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---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"fb666aa7653ba2cdc56816ac575475e5bb58e1b4","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"],"number":199097,"url":"https://github.com/elastic/kibana/pull/199097","mergeCommit":{"message":"[APM]
Migrate apm alerts tests to deployment agnostic (#199097)\n\n##
Summary\r\n\r\nCloses
[#198959](https://github.com/elastic/kibana/issues/198959)\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\nThis PR contains
the changes to migrate `alerts` test folder to\r\nDeployment-agnostic
testing strategy.\r\nIt also fixes a bug when filtering alerts
by\r\n`kibana.alert.rule.producer`. On serverless ,the producer
is\r\n`observability`, not `apm`\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-
This PR won't pass on MKI while the instance is not created using
the\r\n`kibana.alert.rule.producer` fix from this PR\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---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"fb666aa7653ba2cdc56816ac575475e5bb58e1b4"}},"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/199097","number":199097,"mergeCommit":{"message":"[APM]
Migrate apm alerts tests to deployment agnostic (#199097)\n\n##
Summary\r\n\r\nCloses
[#198959](https://github.com/elastic/kibana/issues/198959)\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\nThis PR contains
the changes to migrate `alerts` test folder to\r\nDeployment-agnostic
testing strategy.\r\nIt also fixes a bug when filtering alerts
by\r\n`kibana.alert.rule.producer`. On serverless ,the producer
is\r\n`observability`, not `apm`\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-
This PR won't pass on MKI while the instance is not created using
the\r\n`kibana.alert.rule.producer` fix from this PR\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---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"fb666aa7653ba2cdc56816ac575475e5bb58e1b4"}}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
tkajtoch pushed a commit to tkajtoch/kibana that referenced this pull request Nov 12, 2024
## Summary

Closes [elastic#198959](elastic#198959)
Part of elastic#193245

This PR contains the changes to migrate `alerts` test folder to
Deployment-agnostic testing strategy.
It also fixes a bug when filtering alerts by
`kibana.alert.rule.producer`. On serverless ,the producer is
`observability`, not `apm`

### How to test

- Serverless

```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts --grep="APM"
```

It's recommended to be run against
[MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki)
- This PR won't pass on MKI while the instance is not created using the
`kibana.alert.rule.producer` fix from this PR

- Stateful
```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts --grep="APM"
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Nov 18, 2024
## Summary

Closes [elastic#198959](elastic#198959)
Part of elastic#193245

This PR contains the changes to migrate `alerts` test folder to
Deployment-agnostic testing strategy.
It also fixes a bug when filtering alerts by
`kibana.alert.rule.producer`. On serverless ,the producer is
`observability`, not `apm`

### How to test

- Serverless

```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts --grep="APM"
```

It's recommended to be run against
[MKI](https://github.com/crespocarlos/kibana/blob/main/x-pack/test_serverless/README.md#run-tests-on-mki)
- This PR won't pass on MKI while the instance is not created using the
`kibana.alert.rule.producer` fix from this PR

- Stateful
```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.stateful.config.ts --grep="APM"
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
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.

[APM] Migrate /test/apm_api_integration/tests/alerts to be deployment-agnostic API tests
6 participants