Skip to content

[8.x] FTR - optimize service initialization (#212421)#213213

Merged
pheyos merged 1 commit intoelastic:8.xfrom
pheyos:backport/8.x/pr-212421
Mar 5, 2025
Merged

[8.x] FTR - optimize service initialization (#212421)#213213
pheyos merged 1 commit intoelastic:8.xfrom
pheyos:backport/8.x/pr-212421

Conversation

@pheyos
Copy link
Member

@pheyos pheyos commented Mar 5, 2025

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

## Summary

This PR optimizes the FTR service initialization by not loading UI
service for API tests and by removing retries during test user setup

## Changes

- Remove loading of common UI services from common services (UI services
should not be loaded for API tests)
- Move `security` service from `@kbn/ftr-common-functional-ui-services`
to `@kbn/ftr-common-functional-services` as it should be available to
API tests as well
- Only try once to delete `testUser` during init (this user usually does
not exist on a fresh deployment - and if it does, a single delete
request is enough to get rid of it)

## Benchmark results

**These changes will reduce FTR CI runtime overall by ~100 minutes**
:rocket:
Due to parallel workers in CI, the effective runtime of the whole CI job
will be less than that.

- The removal of UI service loading (which includes starting a browser
instance) for API tests reduces init time by ~0.5 seconds. With 313 API
configs that are started on CI, this reduces the runtime overall by ~156
seconds / ~2.6 minutes.
- The removal of test user delete retries reduces init time by ~10
seconds. With 589 FTR configs that are started on CI, this reduces the
runtime overall by ~5890 seconds / ~98 minutes.
- These numbers have been taken on a local machine and since CI workers
are usually slower, we should see at least this amount of improvement if
not more in CI.

(cherry picked from commit 7a381af)

# Conflicts:
#	src/platform/packages/shared/kbn-ftr-common-functional-services/index.ts
@pheyos pheyos requested a review from kibanamachine as a code owner March 5, 2025 09:47
@pheyos pheyos added the backport This PR is a backport of another PR label Mar 5, 2025
@pheyos pheyos enabled auto-merge (squash) March 5, 2025 09:47
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Mar 5, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #30 / saved objects tagging - functional tests dashboard integration listing allows to filter by multiple tags

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/ftr-common-functional-services 86 95 +9
@kbn/ftr-common-functional-ui-services 524 515 -9
total -0

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/ftr-common-functional-services 1 5 +4
@kbn/ftr-common-functional-ui-services 7 3 -4
total -0
Unknown metric groups

API count

id before after diff
@kbn/ftr-common-functional-services 111 120 +9
@kbn/ftr-common-functional-ui-services 564 555 -9
total -0

Copy link
Contributor

@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

@pheyos pheyos merged commit 33b3901 into elastic:8.x Mar 5, 2025
13 checks passed
@pheyos pheyos deleted the backport/8.x/pr-212421 branch March 5, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR Team:Fleet Team label for Observability Data Collection Fleet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants