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 settings API tests to be deployment-agnostic #200762

Conversation

iblancof
Copy link
Contributor

@iblancof iblancof commented Nov 19, 2024

Closes #198989
Part of #193245

This PR contains the changes to migrate settings test folder to deployment-agnostic testing strategy.

Not Migrated

  • agent_configuration: Not available in Serverless.
  • anomaly_detection/no_access: Involves the noAccess user role; we are only migrating tests for viewer, editor, or admin roles.
  • anomaly_detection/update_to_v3: Involves the deletion of ML jobs; we will wait until an "ml" service is available to properly migrate these tests.
  • anomaly_detection/write_user: Involves the deletion of ML jobs; we will wait until an "ml" service is available to properly migrate these tests.

Partially Migrated

  • anomaly_detection/read_user: Involves the apmAllPrivilegesWithoutWriteSettingsUser role; only tests for the read role have been migrated.
  • anomaly_detection/write_user: Involves the apmReadPrivilegesWithWriteSettingsUser role; only tests for the write role have been migrated.
  • apm_indices: Tests based on license have not been migrated.
    custom_link: Involves the apmReadPrivilegesWithWriteSettingsUser role; only tests for the trial write role have been migrated.
  • agent_keys: Involves the manageOwnAgentKeysUser and createAndAllAgentKeysUser roles; only tests for the write role have been migrated.

How to test

  • Serverless
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts 

It's recommended to be run against MKI

  • Stateful
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts 
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts  

Checks

  • (OPTIONAL, only if a test has been unskipped) Run flaky test suite
  • local run for serverless
  • local run for stateful
  • MKI run for serverless

@iblancof iblancof added release_note:skip Skip the PR/issue when compiling release notes apm 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 v8.17.0 labels Nov 19, 2024
@iblancof iblancof self-assigned this Nov 19, 2024
@iblancof iblancof requested review from a team as code owners November 19, 2024 15:33
@elasticmachine
Copy link
Contributor

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

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Nov 19, 2024
Copy link
Contributor

🤖 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!)

Comment on lines +55 to +57
before(async () => {
roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('editor');
});
Copy link
Member

Choose a reason for hiding this comment

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

API key should be invalidated in after hook:

    after(async () => {
      await samlAuth.invalidateM2mApiKeyWithRoleScope(roleAuthc);
    });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I missed that, thank you!

e183e46

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.

LGTM, few nits

describe('When the user does not have the required cluster privileges', () => {
it('should return an error when creating an agent key', async () => {
const error = await expectToReject<ApmApiError>(() =>
createAgentKey(apmApiClient.writeUser, roleAuthc)
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why do we use different sources of authentication here: afaik apmApiClient.writeUser is already authorised with Editor privileges and a another "fresh" API key is passed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The POST /api/apm/agent_keys 2023-10-31 endpoint, when used with the apmApiClient, specifically requires the roleAuthc parameter.

From what I observed in the code, this is necessary because the endpoint is not considered internal, so additional credential information must be included in the request headers.

It seems the credentials require an API key, but the apmApiClient does not have one by default. To address this, we need to create a new role with the appropriate API key attached, ensuring the credentials are correctly passed in the request headers.

I’m not sure about the reasoning behind handling this outside of the apmApiClient instead of within it. Maybe it’s related to the need to invalidate the API key after the tests are run, avoiding the creation and invalidation of keys for every request that requires one.

Perhaps @crespocarlos could share more details about why it’s done this way in case you want to know more about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I'm looking at it, it is weird. We need to improve it.

roleAuthc needs to be passed to apmApi because, as you've said, we need to destroy the key after the test runs, but calling apmApi service with writeUser and then having to pass the apiKey looks very strange.

Copy link
Contributor

@crespocarlos crespocarlos Nov 20, 2024

Choose a reason for hiding this comment

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

For now, lets not use the apmApi to call public APIs. It's a momentary compromise on the strongly typed response, but it'd be less confusing. Let's use the SupertestWithRoleScopeType in this case.

we could type the response manually as:

let response: APIReturnType<'POST /api/apm/agent_keys 2023-10-31'>

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: iblancof#1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ll be using the new apmApiClient.publicApi introduced in iblancof#1.

d50e6bf

@@ -12,31 +12,32 @@ export default function apmApiIntegrationTests({
}: DeploymentAgnosticFtrProviderContext) {
describe('APM', function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for reorg the list. This was bothering me so much.

describe('When the user does not have the required cluster privileges', () => {
it('should return an error when creating an agent key', async () => {
const error = await expectToReject<ApmApiError>(() =>
createAgentKey(apmApiClient.writeUser, roleAuthc)
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I'm looking at it, it is weird. We need to improve it.

roleAuthc needs to be passed to apmApi because, as you've said, we need to destroy the key after the test runs, but calling apmApi service with writeUser and then having to pass the apiKey looks very strange.

iblancof and others added 3 commits November 20, 2024 11:34
…lity/apm/settings/custom_link/custom_link.spec.ts

Co-authored-by: Carlos Crespo <[email protected]>
…lity/apm/settings/apm_indices/apm_indices.spec.ts

Co-authored-by: Carlos Crespo <[email protected]>
@elastic elastic deleted a comment from kibanamachine Nov 21, 2024
@iblancof iblancof requested a review from dmlemeshko November 21, 2024 09:44
…tests-settings-to-be-deployment-agnostic-api-tests
…tests-settings-to-be-deployment-agnostic-api-tests
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.

Thanks for refactoring apmApi service, code LGTM

@iblancof iblancof enabled auto-merge (squash) November 21, 2024 17:13
…tests-settings-to-be-deployment-agnostic-api-tests
@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 21, 2024

💛 Build succeeded, but was flaky

  • Buildkite Build
  • Commit: f5c0e14
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-200762-f5c0e147e77c

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #18 / RootPrivilegesCallout should render callout requiring root privileges

Metrics [docs]

✅ unchanged

History

cc @iblancof

@iblancof iblancof merged commit 05bf56f into elastic:main Nov 21, 2024
24 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.17, 8.x

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

@kibanamachine
Copy link
Contributor

💔 All backports failed

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

Manual backport

To create the backport manually run:

node scripts/backport --pr 200762

Questions ?

Please refer to the Backport tool documentation

@iblancof
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.17

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

Questions ?

Please refer to the Backport tool documentation

@iblancof
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

iblancof added a commit to iblancof/kibana that referenced this pull request Nov 22, 2024
…00762)

Closes elastic#198989
Part of elastic#193245

This PR contains the changes to migrate `settings` test folder to
deployment-agnostic testing strategy.

**Not Migrated**
- `agent_configuration`: Not available in Serverless.
- `anomaly_detection/no_access`: Involves the `noAccess` user role; we
are only migrating tests for `viewer`, `editor`, or `admin` roles.
- `anomaly_detection/update_to_v3`: Involves the deletion of ML jobs; we
will wait until an "ml" service is available to properly migrate these
tests.
- `anomaly_detection/write_user`: Involves the deletion of ML jobs; we
will wait until an "ml" service is available to properly migrate these
tests.

**Partially Migrated**
- `anomaly_detection/read_user`: Involves the
`apmAllPrivilegesWithoutWriteSettingsUser` role; only tests for the
`read` role have been migrated.
- `anomaly_detection/write_user`: Involves the
`apmReadPrivilegesWithWriteSettingsUser` role; only tests for the
`write` role have been migrated.
- `apm_indices`: Tests based on license have not been migrated.
custom_link: Involves the `apmReadPrivilegesWithWriteSettingsUser` role;
only tests for the trial `write` role have been migrated.
- `agent_keys`: Involves the `manageOwnAgentKeysUser` and
`createAndAllAgentKeysUser` roles; only tests for the `write` role have
been migrated.

### How to test

- Serverless

```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
```

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)

- Stateful
```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts
```

## Checks

- [ ] (OPTIONAL, only if a test has been unskipped) Run flaky test suite
- [x] local run for serverless
- [x] local run for stateful
- [x] MKI run for serverless

<!--ONMERGE {"backportTargets":["8.x"]} ONMERGE-->

---------

Co-authored-by: Carlos Crespo <[email protected]>
Co-authored-by: Carlos Crespo <[email protected]>
(cherry picked from commit 05bf56f)

# Conflicts:
#	x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/index.ts
iblancof added a commit that referenced this pull request Nov 22, 2024
…00762) (#201327)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[APM] Migrate settings API tests to be deployment-agnostic
(#200762)](#200762)

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

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

<!--BACKPORT [{"author":{"name":"Irene
Blanco","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-21T22:08:49Z","message":"[APM]
Migrate settings API tests to be deployment-agnostic (#200762)\n\nCloses
https://github.com/elastic/kibana/issues/198989\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\nThis PR contains
the changes to migrate `settings` test folder to\r\ndeployment-agnostic
testing strategy.\r\n\r\n\r\n**Not Migrated**\r\n-
`agent_configuration`: Not available in Serverless.\r\n-
`anomaly_detection/no_access`: Involves the `noAccess` user role;
we\r\nare only migrating tests for `viewer`, `editor`, or `admin`
roles.\r\n- `anomaly_detection/update_to_v3`: Involves the deletion of
ML jobs; we\r\nwill wait until an \"ml\" service is available to
properly migrate these\r\ntests.\r\n- `anomaly_detection/write_user`:
Involves the deletion of ML jobs; we\r\nwill wait until an \"ml\"
service is available to properly migrate
these\r\ntests.\r\n\r\n**Partially Migrated**\r\n-
`anomaly_detection/read_user`: Involves
the\r\n`apmAllPrivilegesWithoutWriteSettingsUser` role; only tests for
the\r\n`read` role have been migrated.\r\n-
`anomaly_detection/write_user`: Involves
the\r\n`apmReadPrivilegesWithWriteSettingsUser` role; only tests for
the\r\n`write` role have been migrated.\r\n- `apm_indices`: Tests based
on license have not been migrated.\r\ncustom_link: Involves the
`apmReadPrivilegesWithWriteSettingsUser` role;\r\nonly tests for the
trial `write` role have been migrated.\r\n- `agent_keys`: Involves the
`manageOwnAgentKeysUser` and\r\n`createAndAllAgentKeysUser` roles; only
tests for the `write` role have\r\nbeen migrated.\r\n\r\n### How to
test\r\n\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.apm.serverless.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
\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.apm.stateful.config.ts
\r\nnode scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts
\r\n```\r\n\r\n## Checks\r\n\r\n- [ ] (OPTIONAL, only if a test has been
unskipped) Run flaky test suite\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<!--ONMERGE {\"backportTargets\":[\"8.x\"]}
ONMERGE-->\r\n\r\n---------\r\n\r\nCo-authored-by: Carlos Crespo
<[email protected]>\r\nCo-authored-by: Carlos Crespo
<[email protected]>","sha":"05bf56f3365e9f273bad6d29cc5855d9c3607fc7","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","apm","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services","v8.17.0"],"number":200762,"url":"https://github.com/elastic/kibana/pull/200762","mergeCommit":{"message":"[APM]
Migrate settings API tests to be deployment-agnostic (#200762)\n\nCloses
https://github.com/elastic/kibana/issues/198989\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\nThis PR contains
the changes to migrate `settings` test folder to\r\ndeployment-agnostic
testing strategy.\r\n\r\n\r\n**Not Migrated**\r\n-
`agent_configuration`: Not available in Serverless.\r\n-
`anomaly_detection/no_access`: Involves the `noAccess` user role;
we\r\nare only migrating tests for `viewer`, `editor`, or `admin`
roles.\r\n- `anomaly_detection/update_to_v3`: Involves the deletion of
ML jobs; we\r\nwill wait until an \"ml\" service is available to
properly migrate these\r\ntests.\r\n- `anomaly_detection/write_user`:
Involves the deletion of ML jobs; we\r\nwill wait until an \"ml\"
service is available to properly migrate
these\r\ntests.\r\n\r\n**Partially Migrated**\r\n-
`anomaly_detection/read_user`: Involves
the\r\n`apmAllPrivilegesWithoutWriteSettingsUser` role; only tests for
the\r\n`read` role have been migrated.\r\n-
`anomaly_detection/write_user`: Involves
the\r\n`apmReadPrivilegesWithWriteSettingsUser` role; only tests for
the\r\n`write` role have been migrated.\r\n- `apm_indices`: Tests based
on license have not been migrated.\r\ncustom_link: Involves the
`apmReadPrivilegesWithWriteSettingsUser` role;\r\nonly tests for the
trial `write` role have been migrated.\r\n- `agent_keys`: Involves the
`manageOwnAgentKeysUser` and\r\n`createAndAllAgentKeysUser` roles; only
tests for the `write` role have\r\nbeen migrated.\r\n\r\n### How to
test\r\n\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.apm.serverless.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
\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.apm.stateful.config.ts
\r\nnode scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts
\r\n```\r\n\r\n## Checks\r\n\r\n- [ ] (OPTIONAL, only if a test has been
unskipped) Run flaky test suite\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<!--ONMERGE {\"backportTargets\":[\"8.x\"]}
ONMERGE-->\r\n\r\n---------\r\n\r\nCo-authored-by: Carlos Crespo
<[email protected]>\r\nCo-authored-by: Carlos Crespo
<[email protected]>","sha":"05bf56f3365e9f273bad6d29cc5855d9c3607fc7"}},"sourceBranch":"main","suggestedTargetBranches":["8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200762","number":200762,"mergeCommit":{"message":"[APM]
Migrate settings API tests to be deployment-agnostic (#200762)\n\nCloses
https://github.com/elastic/kibana/issues/198989\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\nThis PR contains
the changes to migrate `settings` test folder to\r\ndeployment-agnostic
testing strategy.\r\n\r\n\r\n**Not Migrated**\r\n-
`agent_configuration`: Not available in Serverless.\r\n-
`anomaly_detection/no_access`: Involves the `noAccess` user role;
we\r\nare only migrating tests for `viewer`, `editor`, or `admin`
roles.\r\n- `anomaly_detection/update_to_v3`: Involves the deletion of
ML jobs; we\r\nwill wait until an \"ml\" service is available to
properly migrate these\r\ntests.\r\n- `anomaly_detection/write_user`:
Involves the deletion of ML jobs; we\r\nwill wait until an \"ml\"
service is available to properly migrate
these\r\ntests.\r\n\r\n**Partially Migrated**\r\n-
`anomaly_detection/read_user`: Involves
the\r\n`apmAllPrivilegesWithoutWriteSettingsUser` role; only tests for
the\r\n`read` role have been migrated.\r\n-
`anomaly_detection/write_user`: Involves
the\r\n`apmReadPrivilegesWithWriteSettingsUser` role; only tests for
the\r\n`write` role have been migrated.\r\n- `apm_indices`: Tests based
on license have not been migrated.\r\ncustom_link: Involves the
`apmReadPrivilegesWithWriteSettingsUser` role;\r\nonly tests for the
trial `write` role have been migrated.\r\n- `agent_keys`: Involves the
`manageOwnAgentKeysUser` and\r\n`createAndAllAgentKeysUser` roles; only
tests for the `write` role have\r\nbeen migrated.\r\n\r\n### How to
test\r\n\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.apm.serverless.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
\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.apm.stateful.config.ts
\r\nnode scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts
\r\n```\r\n\r\n## Checks\r\n\r\n- [ ] (OPTIONAL, only if a test has been
unskipped) Run flaky test suite\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<!--ONMERGE {\"backportTargets\":[\"8.x\"]}
ONMERGE-->\r\n\r\n---------\r\n\r\nCo-authored-by: Carlos Crespo
<[email protected]>\r\nCo-authored-by: Carlos Crespo
<[email protected]>","sha":"05bf56f3365e9f273bad6d29cc5855d9c3607fc7"}},{"branch":"8.17","label":"v8.17.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
iblancof added a commit that referenced this pull request Nov 22, 2024
…0762) (#201328)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[APM] Migrate settings API tests to be deployment-agnostic
(#200762)](#200762)

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

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

<!--BACKPORT [{"author":{"name":"Irene
Blanco","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-21T22:08:49Z","message":"[APM]
Migrate settings API tests to be deployment-agnostic (#200762)\n\nCloses
https://github.com/elastic/kibana/issues/198989\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\nThis PR contains
the changes to migrate `settings` test folder to\r\ndeployment-agnostic
testing strategy.\r\n\r\n\r\n**Not Migrated**\r\n-
`agent_configuration`: Not available in Serverless.\r\n-
`anomaly_detection/no_access`: Involves the `noAccess` user role;
we\r\nare only migrating tests for `viewer`, `editor`, or `admin`
roles.\r\n- `anomaly_detection/update_to_v3`: Involves the deletion of
ML jobs; we\r\nwill wait until an \"ml\" service is available to
properly migrate these\r\ntests.\r\n- `anomaly_detection/write_user`:
Involves the deletion of ML jobs; we\r\nwill wait until an \"ml\"
service is available to properly migrate
these\r\ntests.\r\n\r\n**Partially Migrated**\r\n-
`anomaly_detection/read_user`: Involves
the\r\n`apmAllPrivilegesWithoutWriteSettingsUser` role; only tests for
the\r\n`read` role have been migrated.\r\n-
`anomaly_detection/write_user`: Involves
the\r\n`apmReadPrivilegesWithWriteSettingsUser` role; only tests for
the\r\n`write` role have been migrated.\r\n- `apm_indices`: Tests based
on license have not been migrated.\r\ncustom_link: Involves the
`apmReadPrivilegesWithWriteSettingsUser` role;\r\nonly tests for the
trial `write` role have been migrated.\r\n- `agent_keys`: Involves the
`manageOwnAgentKeysUser` and\r\n`createAndAllAgentKeysUser` roles; only
tests for the `write` role have\r\nbeen migrated.\r\n\r\n### How to
test\r\n\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.apm.serverless.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
\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.apm.stateful.config.ts
\r\nnode scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts
\r\n```\r\n\r\n## Checks\r\n\r\n- [ ] (OPTIONAL, only if a test has been
unskipped) Run flaky test suite\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<!--ONMERGE {\"backportTargets\":[\"8.x\"]}
ONMERGE-->\r\n\r\n---------\r\n\r\nCo-authored-by: Carlos Crespo
<[email protected]>\r\nCo-authored-by: Carlos Crespo
<[email protected]>","sha":"05bf56f3365e9f273bad6d29cc5855d9c3607fc7","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","apm","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services","v8.17.0"],"number":200762,"url":"https://github.com/elastic/kibana/pull/200762","mergeCommit":{"message":"[APM]
Migrate settings API tests to be deployment-agnostic (#200762)\n\nCloses
https://github.com/elastic/kibana/issues/198989\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\nThis PR contains
the changes to migrate `settings` test folder to\r\ndeployment-agnostic
testing strategy.\r\n\r\n\r\n**Not Migrated**\r\n-
`agent_configuration`: Not available in Serverless.\r\n-
`anomaly_detection/no_access`: Involves the `noAccess` user role;
we\r\nare only migrating tests for `viewer`, `editor`, or `admin`
roles.\r\n- `anomaly_detection/update_to_v3`: Involves the deletion of
ML jobs; we\r\nwill wait until an \"ml\" service is available to
properly migrate these\r\ntests.\r\n- `anomaly_detection/write_user`:
Involves the deletion of ML jobs; we\r\nwill wait until an \"ml\"
service is available to properly migrate
these\r\ntests.\r\n\r\n**Partially Migrated**\r\n-
`anomaly_detection/read_user`: Involves
the\r\n`apmAllPrivilegesWithoutWriteSettingsUser` role; only tests for
the\r\n`read` role have been migrated.\r\n-
`anomaly_detection/write_user`: Involves
the\r\n`apmReadPrivilegesWithWriteSettingsUser` role; only tests for
the\r\n`write` role have been migrated.\r\n- `apm_indices`: Tests based
on license have not been migrated.\r\ncustom_link: Involves the
`apmReadPrivilegesWithWriteSettingsUser` role;\r\nonly tests for the
trial `write` role have been migrated.\r\n- `agent_keys`: Involves the
`manageOwnAgentKeysUser` and\r\n`createAndAllAgentKeysUser` roles; only
tests for the `write` role have\r\nbeen migrated.\r\n\r\n### How to
test\r\n\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.apm.serverless.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
\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.apm.stateful.config.ts
\r\nnode scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts
\r\n```\r\n\r\n## Checks\r\n\r\n- [ ] (OPTIONAL, only if a test has been
unskipped) Run flaky test suite\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<!--ONMERGE {\"backportTargets\":[\"8.x\"]}
ONMERGE-->\r\n\r\n---------\r\n\r\nCo-authored-by: Carlos Crespo
<[email protected]>\r\nCo-authored-by: Carlos Crespo
<[email protected]>","sha":"05bf56f3365e9f273bad6d29cc5855d9c3607fc7"}},"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/200762","number":200762,"mergeCommit":{"message":"[APM]
Migrate settings API tests to be deployment-agnostic (#200762)\n\nCloses
https://github.com/elastic/kibana/issues/198989\r\nPart of
https://github.com/elastic/kibana/issues/193245\r\n\r\nThis PR contains
the changes to migrate `settings` test folder to\r\ndeployment-agnostic
testing strategy.\r\n\r\n\r\n**Not Migrated**\r\n-
`agent_configuration`: Not available in Serverless.\r\n-
`anomaly_detection/no_access`: Involves the `noAccess` user role;
we\r\nare only migrating tests for `viewer`, `editor`, or `admin`
roles.\r\n- `anomaly_detection/update_to_v3`: Involves the deletion of
ML jobs; we\r\nwill wait until an \"ml\" service is available to
properly migrate these\r\ntests.\r\n- `anomaly_detection/write_user`:
Involves the deletion of ML jobs; we\r\nwill wait until an \"ml\"
service is available to properly migrate
these\r\ntests.\r\n\r\n**Partially Migrated**\r\n-
`anomaly_detection/read_user`: Involves
the\r\n`apmAllPrivilegesWithoutWriteSettingsUser` role; only tests for
the\r\n`read` role have been migrated.\r\n-
`anomaly_detection/write_user`: Involves
the\r\n`apmReadPrivilegesWithWriteSettingsUser` role; only tests for
the\r\n`write` role have been migrated.\r\n- `apm_indices`: Tests based
on license have not been migrated.\r\ncustom_link: Involves the
`apmReadPrivilegesWithWriteSettingsUser` role;\r\nonly tests for the
trial `write` role have been migrated.\r\n- `agent_keys`: Involves the
`manageOwnAgentKeysUser` and\r\n`createAndAllAgentKeysUser` roles; only
tests for the `write` role have\r\nbeen migrated.\r\n\r\n### How to
test\r\n\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.apm.serverless.config.ts\r\nnode
scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
\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.apm.stateful.config.ts
\r\nnode scripts/functional_test_runner --config
x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts
\r\n```\r\n\r\n## Checks\r\n\r\n- [ ] (OPTIONAL, only if a test has been
unskipped) Run flaky test suite\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<!--ONMERGE {\"backportTargets\":[\"8.x\"]}
ONMERGE-->\r\n\r\n---------\r\n\r\nCo-authored-by: Carlos Crespo
<[email protected]>\r\nCo-authored-by: Carlos Crespo
<[email protected]>","sha":"05bf56f3365e9f273bad6d29cc5855d9c3607fc7"}},{"branch":"8.17","label":"v8.17.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/201327","number":201327,"state":"OPEN"}]}]
BACKPORT-->
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Nov 26, 2024
…00762)

Closes elastic#198989
Part of elastic#193245

This PR contains the changes to migrate `settings` test folder to
deployment-agnostic testing strategy.


**Not Migrated**
- `agent_configuration`: Not available in Serverless.
- `anomaly_detection/no_access`: Involves the `noAccess` user role; we
are only migrating tests for `viewer`, `editor`, or `admin` roles.
- `anomaly_detection/update_to_v3`: Involves the deletion of ML jobs; we
will wait until an "ml" service is available to properly migrate these
tests.
- `anomaly_detection/write_user`: Involves the deletion of ML jobs; we
will wait until an "ml" service is available to properly migrate these
tests.

**Partially Migrated**
- `anomaly_detection/read_user`: Involves the
`apmAllPrivilegesWithoutWriteSettingsUser` role; only tests for the
`read` role have been migrated.
- `anomaly_detection/write_user`: Involves the
`apmReadPrivilegesWithWriteSettingsUser` role; only tests for the
`write` role have been migrated.
- `apm_indices`: Tests based on license have not been migrated.
custom_link: Involves the `apmReadPrivilegesWithWriteSettingsUser` role;
only tests for the trial `write` role have been migrated.
- `agent_keys`: Involves the `manageOwnAgentKeysUser` and
`createAndAllAgentKeysUser` roles; only tests for the `write` role have
been migrated.

### How to test


- Serverless

```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts 
```

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)

- Stateful
```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts 
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts  
```

## Checks

- [ ] (OPTIONAL, only if a test has been unskipped) Run flaky test suite
- [x] local run for serverless
- [x] local run for stateful
- [x] MKI run for serverless 

<!--ONMERGE {"backportTargets":["8.x"]} ONMERGE-->

---------

Co-authored-by: Carlos Crespo <[email protected]>
Co-authored-by: Carlos Crespo <[email protected]>
@iblancof iblancof deleted the 198989-apm-migrate-test-apm_api_integration-tests-settings-to-be-deployment-agnostic-api-tests branch December 2, 2024 13:39
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
…00762)

Closes elastic#198989
Part of elastic#193245

This PR contains the changes to migrate `settings` test folder to
deployment-agnostic testing strategy.


**Not Migrated**
- `agent_configuration`: Not available in Serverless.
- `anomaly_detection/no_access`: Involves the `noAccess` user role; we
are only migrating tests for `viewer`, `editor`, or `admin` roles.
- `anomaly_detection/update_to_v3`: Involves the deletion of ML jobs; we
will wait until an "ml" service is available to properly migrate these
tests.
- `anomaly_detection/write_user`: Involves the deletion of ML jobs; we
will wait until an "ml" service is available to properly migrate these
tests.

**Partially Migrated**
- `anomaly_detection/read_user`: Involves the
`apmAllPrivilegesWithoutWriteSettingsUser` role; only tests for the
`read` role have been migrated.
- `anomaly_detection/write_user`: Involves the
`apmReadPrivilegesWithWriteSettingsUser` role; only tests for the
`write` role have been migrated.
- `apm_indices`: Tests based on license have not been migrated.
custom_link: Involves the `apmReadPrivilegesWithWriteSettingsUser` role;
only tests for the trial `write` role have been migrated.
- `agent_keys`: Involves the `manageOwnAgentKeysUser` and
`createAndAllAgentKeysUser` roles; only tests for the `write` role have
been migrated.

### How to test


- Serverless

```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts 
```

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)

- Stateful
```
node scripts/functional_tests_server --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts 
node scripts/functional_test_runner --config x-pack/test/api_integration/deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts  
```

## Checks

- [ ] (OPTIONAL, only if a test has been unskipped) Run flaky test suite
- [x] local run for serverless
- [x] local run for stateful
- [x] MKI run for serverless 

<!--ONMERGE {"backportTargets":["8.x"]} ONMERGE-->

---------

Co-authored-by: Carlos Crespo <[email protected]>
Co-authored-by: Carlos Crespo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm 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 v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] Migrate /test/apm_api_integration/tests/settings/ to be deployment-agnostic API tests
5 participants