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

Migrate Metric threshold rule tests to deployment agnostic solution #183401

Closed
mgiota opened this issue May 14, 2024 · 5 comments
Closed

Migrate Metric threshold rule tests to deployment agnostic solution #183401

mgiota opened this issue May 14, 2024 · 5 comments
Assignees
Labels
Team:obs-ux-management Observability Management User Experience Team

Comments

@mgiota
Copy link
Contributor

mgiota commented May 14, 2024

Part of #183263

🍒 Summary

As part of this PR we introduced a way to write deployment agnostic tests using the deployment agnostic framework from Appex QA team. We want to migrate the existing metric threshold rule tests to the new agnostic framework.

Existing tests

Test Type ESS Serverless Notes
Metric threshold rule type Alerting ESS: x-pack/test/alerting_api_integration/observability/metric_threshold_rule.ts

File structure

How to migrate

In this PR oblt.stateful.config.ts and oblt.serverless.config.ts were added, so no need to create any config file.
Existing metric threshold rule tests use a few alerting helpers. In the SLO burn rate rule PR the alerting API was migrated to the deployment agnostic folder. As part of the migration we should use the migrating alerting api.

Here's what you have to do:

  • Move metric threshold rule tests from x-pack/test/alerting_api_integration/observability/metric_threshold_rule.ts within x-pack/test/api_integration/deployment_agnostic/apis/observability/alerting folder
  • Add the metric threshold rule test in this file
    loadTestFile(require.resolve('./metric_threshold_rule'));
  • Delete the metric threshold rule test from the old alerting_api_integration location
  • Use the DeploymentAgnosticFtrProviderContext
  • use a combination of supertestWithoutAuth and samlAuth to generate an API key for user roles and make API calls
const samlAuth = getService('samlAuth');
const supertestWithoutAuth = getService('supertestWithoutAuth');
  • Use the config service to decide on the expected consumer
const config = getService('config');
const isServerless = config.get('serverless');
const expectedConsumer = isServerless ? 'observability' : 'infrastructure';
  • Update the metric threshold rule tests to use the deployment agnostic alerting api

How to run

To run 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="Metric threshold rule"

To run 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="Metric threshold rule"
@botelastic botelastic bot added the needs-team Issues missing a team label label May 14, 2024
@mgiota mgiota added the Team:obs-ux-management Observability Management User Experience Team label May 14, 2024
@elasticmachine
Copy link
Contributor

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

@botelastic botelastic bot removed the needs-team Issues missing a team label label May 14, 2024
@maryam-saeidi
Copy link
Member

Moved to backlog until the related Meta ticket is prioritized.

@jasonrhodes
Copy link
Member

I think we need to update these instructions so they are up to date with the latest on deployment agnostic testing before this issue is "Ready", but then we need to pull this in ASAP.

@maryam-saeidi maryam-saeidi self-assigned this Oct 2, 2024
@maryam-saeidi
Copy link
Member

Example PR: #187924

@mgiota
Copy link
Contributor Author

mgiota commented Oct 10, 2024

It turns out Metric threshold rule type is not registered on serverless, so I am closing this issue. No need to migrate Metric threshold rule types to the deployment agnostic framework.

Image

@mgiota mgiota closed this as completed Oct 10, 2024
@maryam-saeidi maryam-saeidi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:obs-ux-management Observability Management User Experience Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants