Skip to content

[tests] split up serverless and resource leaks integration tests #8396

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

Merged

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Jun 9, 2025

What does this PR do?

This PR refactors the Elastic Agent integration test structure by introducing dedicated sub-packages for specific test categories. The changes include:

  • New serverless and leak test packages under testing/integration/, each with their own TestMain.
  • Moved long-running resource leak tests to the leak package and removed the dependency on the TEST_LONG_RUNNING env var.
  • Moved TestLogIngestionFleetManaged into a reusable function and invoked it from both integration and serverless packages.
  • Normalized test entrypoints across Windows (PowerShell) and Unix (Bash) runners.
  • Made PreinstalledPackages public and importable by other test packages.
  • Renamed groups_test.go to groups.go to support shared usage.
  • Enhanced mage integration:check to validate all test packages (integration/, integration/serverless, integration/leak).
  • Updated Buildkite test scripts and pipeline definitions to accommodate the split.

Why is it important?

The testing/integration package had grown into a monolithic and hard-to-maintain suite containing various unrelated test types. This structural refactor:

  • Improves clarity and maintainability by grouping tests by setup type (e.g., serverless, extended runtime).
  • Reduces reliance on complex filtering logic using env vars or CLI args.
  • Enables tailored TestMain implementations per package for better control of setup/teardown behavior.
  • Builds a solid baseline for better alignment of Buildkite pipelines and runtime configurations.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

None expected for end-users. CI and internal contributors may need to adjust test invocation to use the correct package path or mage targets (e.g., mage integration:testServerless, integration:testForResourceLeaks).

How to test this PR locally

# Run standard integration tests
mage integration:test

# Run serverless smoke tests
mage integration:testServerless

# Run extended leak tests
mage integration:testForResourceLeaks

Related issues

@pkoutsovasilis pkoutsovasilis self-assigned this Jun 9, 2025
@pkoutsovasilis pkoutsovasilis added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog backport-active-all Automated backport with mergify to all the active branches labels Jun 9, 2025
@pkoutsovasilis
Copy link
Contributor Author

@pchila @ycombinator please have a look and let's sync 🙂

@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review June 9, 2025 09:34
@pkoutsovasilis pkoutsovasilis requested review from a team as code owners June 9, 2025 09:34
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

pchila
pchila previously approved these changes Jun 9, 2025
Copy link
Member

@pchila pchila left a comment

Choose a reason for hiding this comment

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

LGTM
Thank you for splitting out runtime leak and serverless tests into dedicated packages.
The work on the serverless test could be used to simplify #8263 change to a more manageable size.

v1v
v1v previously approved these changes Jun 9, 2025
Copy link
Member

@v1v v1v left a comment

Choose a reason for hiding this comment

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

LGTM, just added a very tiny nits

@pkoutsovasilis pkoutsovasilis dismissed stale reviews from v1v and pchila via f4f395c June 9, 2025 10:26
v1v
v1v previously approved these changes Jun 9, 2025
Copy link
Member

@v1v v1v left a comment

Choose a reason for hiding this comment

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

LGTM, I reviewed the .buildkite folder, again my nits are super-nit.

@pkoutsovasilis pkoutsovasilis dismissed stale reviews from v1v, pchila, and dliappis via f088a5f June 11, 2025 14:48
Copy link

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @pkoutsovasilis

Copy link
Member

@v1v v1v left a comment

Choose a reason for hiding this comment

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

LGTM, I reviewed the recent changes in the .buldkite folder after reviewing them earlier too :)
Thank you for your collaboration on the various review comments 🙇

@pkoutsovasilis pkoutsovasilis merged commit 92e139c into elastic:main Jun 11, 2025
11 checks passed
@pkoutsovasilis pkoutsovasilis deleted the feat/split_up_integration_tests branch June 11, 2025 17:44
Copy link
Contributor

@Mergifyio backport 8.17 8.18 8.19 9.0

Copy link
Contributor

mergify bot commented Jun 11, 2025

backport 8.17 8.18 8.19 9.0

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jun 11, 2025
* fix: expose PreinstalledPackages

* fix: make groups.go importable

* feat: introduce new leak package for integration tests

* feat: introduce new serverless package for integration tests

* feat: incorporate serverless and extended runtime leak tests in mage

* fix: normalise powershell (windows) and bash (unix) integration tests invocation flow

* fix: use -test prefixed args for test-wise argument in buildkite-integration-tests.ps1

* fix: add comment about test timeout 2h0m0s

* fix: correct wording

* doc: add integration:TestServerless and update integration:TestForResourceLeaks in test-framework-dev-guide.md

* fix: return directly the test exit code for ps1 scripts

* fix: rename file that host TestMain to main_test.go

* fix: correct build tags for serverless integration tests package

* fix: leverage log.Fatalf in serverless/main_test.go

* feat: expand the BK log group on failure

* tmp: introduce artificial test failure to test buildkite logging group expansion

* Revert "tmp: introduce artificial test failure to test buildkite logging group expansion"

This reverts commit ee6bd63.

* fix: typo

* fix: remove redundant BK log group expansion

(cherry picked from commit 92e139c)

# Conflicts:
#	.buildkite/scripts/buildkite-integration-tests.sh
#	.buildkite/scripts/integration-tests.ps1
#	testing/integration/auditd_monitoring_test.go
#	testing/integration/fleetserver_test.go
#	testing/integration/logs_ingestion_test.go
#	testing/integration/network_traffic_monitoring_test.go
#	testing/integration/osquery_monitoring_test.go
mergify bot pushed a commit that referenced this pull request Jun 11, 2025
* fix: expose PreinstalledPackages

* fix: make groups.go importable

* feat: introduce new leak package for integration tests

* feat: introduce new serverless package for integration tests

* feat: incorporate serverless and extended runtime leak tests in mage

* fix: normalise powershell (windows) and bash (unix) integration tests invocation flow

* fix: use -test prefixed args for test-wise argument in buildkite-integration-tests.ps1

* fix: add comment about test timeout 2h0m0s

* fix: correct wording

* doc: add integration:TestServerless and update integration:TestForResourceLeaks in test-framework-dev-guide.md

* fix: return directly the test exit code for ps1 scripts

* fix: rename file that host TestMain to main_test.go

* fix: correct build tags for serverless integration tests package

* fix: leverage log.Fatalf in serverless/main_test.go

* feat: expand the BK log group on failure

* tmp: introduce artificial test failure to test buildkite logging group expansion

* Revert "tmp: introduce artificial test failure to test buildkite logging group expansion"

This reverts commit ee6bd63.

* fix: typo

* fix: remove redundant BK log group expansion

(cherry picked from commit 92e139c)

# Conflicts:
#	.buildkite/scripts/buildkite-integration-tests.sh
#	.buildkite/scripts/integration-tests.ps1
#	testing/integration/auditd_monitoring_test.go
#	testing/integration/fleetserver_test.go
#	testing/integration/network_traffic_monitoring_test.go
#	testing/integration/osquery_monitoring_test.go
mergify bot pushed a commit that referenced this pull request Jun 11, 2025
* fix: expose PreinstalledPackages

* fix: make groups.go importable

* feat: introduce new leak package for integration tests

* feat: introduce new serverless package for integration tests

* feat: incorporate serverless and extended runtime leak tests in mage

* fix: normalise powershell (windows) and bash (unix) integration tests invocation flow

* fix: use -test prefixed args for test-wise argument in buildkite-integration-tests.ps1

* fix: add comment about test timeout 2h0m0s

* fix: correct wording

* doc: add integration:TestServerless and update integration:TestForResourceLeaks in test-framework-dev-guide.md

* fix: return directly the test exit code for ps1 scripts

* fix: rename file that host TestMain to main_test.go

* fix: correct build tags for serverless integration tests package

* fix: leverage log.Fatalf in serverless/main_test.go

* feat: expand the BK log group on failure

* tmp: introduce artificial test failure to test buildkite logging group expansion

* Revert "tmp: introduce artificial test failure to test buildkite logging group expansion"

This reverts commit ee6bd63.

* fix: typo

* fix: remove redundant BK log group expansion

(cherry picked from commit 92e139c)

# Conflicts:
#	.buildkite/scripts/integration-tests.ps1
#	testing/integration/auditd_monitoring_test.go
#	testing/integration/fleetserver_test.go
#	testing/integration/network_traffic_monitoring_test.go
#	testing/integration/osquery_monitoring_test.go
mergify bot pushed a commit that referenced this pull request Jun 11, 2025
* fix: expose PreinstalledPackages

* fix: make groups.go importable

* feat: introduce new leak package for integration tests

* feat: introduce new serverless package for integration tests

* feat: incorporate serverless and extended runtime leak tests in mage

* fix: normalise powershell (windows) and bash (unix) integration tests invocation flow

* fix: use -test prefixed args for test-wise argument in buildkite-integration-tests.ps1

* fix: add comment about test timeout 2h0m0s

* fix: correct wording

* doc: add integration:TestServerless and update integration:TestForResourceLeaks in test-framework-dev-guide.md

* fix: return directly the test exit code for ps1 scripts

* fix: rename file that host TestMain to main_test.go

* fix: correct build tags for serverless integration tests package

* fix: leverage log.Fatalf in serverless/main_test.go

* feat: expand the BK log group on failure

* tmp: introduce artificial test failure to test buildkite logging group expansion

* Revert "tmp: introduce artificial test failure to test buildkite logging group expansion"

This reverts commit ee6bd63.

* fix: typo

* fix: remove redundant BK log group expansion

(cherry picked from commit 92e139c)

# Conflicts:
#	.buildkite/scripts/buildkite-integration-tests.sh
#	.buildkite/scripts/integration-tests.ps1
#	testing/integration/auditd_monitoring_test.go
#	testing/integration/network_traffic_monitoring_test.go
#	testing/integration/osquery_monitoring_test.go
pkoutsovasilis added a commit that referenced this pull request Jun 12, 2025
… integration tests (#8458)

* [tests] split up serverless and resource leaks integration tests (#8396)

* fix: expose PreinstalledPackages

* fix: make groups.go importable

* feat: introduce new leak package for integration tests

* feat: introduce new serverless package for integration tests

* feat: incorporate serverless and extended runtime leak tests in mage

* fix: normalise powershell (windows) and bash (unix) integration tests invocation flow

* fix: use -test prefixed args for test-wise argument in buildkite-integration-tests.ps1

* fix: add comment about test timeout 2h0m0s

* fix: correct wording

* doc: add integration:TestServerless and update integration:TestForResourceLeaks in test-framework-dev-guide.md

* fix: return directly the test exit code for ps1 scripts

* fix: rename file that host TestMain to main_test.go

* fix: correct build tags for serverless integration tests package

* fix: leverage log.Fatalf in serverless/main_test.go

* feat: expand the BK log group on failure

* tmp: introduce artificial test failure to test buildkite logging group expansion

* Revert "tmp: introduce artificial test failure to test buildkite logging group expansion"

This reverts commit ee6bd63.

* fix: typo

* fix: remove redundant BK log group expansion

(cherry picked from commit 92e139c)

# Conflicts:
#	.buildkite/scripts/buildkite-integration-tests.sh
#	.buildkite/scripts/integration-tests.ps1
#	testing/integration/auditd_monitoring_test.go
#	testing/integration/network_traffic_monitoring_test.go
#	testing/integration/osquery_monitoring_test.go

* fix: resolve conflicts

* fix: remove -integration.fips flag

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
pkoutsovasilis added a commit that referenced this pull request Jun 12, 2025
…s integration tests (#8457)

* [tests] split up serverless and resource leaks integration tests (#8396)

* fix: expose PreinstalledPackages

* fix: make groups.go importable

* feat: introduce new leak package for integration tests

* feat: introduce new serverless package for integration tests

* feat: incorporate serverless and extended runtime leak tests in mage

* fix: normalise powershell (windows) and bash (unix) integration tests invocation flow

* fix: use -test prefixed args for test-wise argument in buildkite-integration-tests.ps1

* fix: add comment about test timeout 2h0m0s

* fix: correct wording

* doc: add integration:TestServerless and update integration:TestForResourceLeaks in test-framework-dev-guide.md

* fix: return directly the test exit code for ps1 scripts

* fix: rename file that host TestMain to main_test.go

* fix: correct build tags for serverless integration tests package

* fix: leverage log.Fatalf in serverless/main_test.go

* feat: expand the BK log group on failure

* tmp: introduce artificial test failure to test buildkite logging group expansion

* Revert "tmp: introduce artificial test failure to test buildkite logging group expansion"

This reverts commit ee6bd63.

* fix: typo

* fix: remove redundant BK log group expansion

(cherry picked from commit 92e139c)

# Conflicts:
#	.buildkite/scripts/integration-tests.ps1
#	testing/integration/auditd_monitoring_test.go
#	testing/integration/fleetserver_test.go
#	testing/integration/network_traffic_monitoring_test.go
#	testing/integration/osquery_monitoring_test.go

* fix: resolve conflicts

* fix: remove irrelevant files

* fix: point to the correct path for "fleet-server.json" in TestInstallFleetServerBootstrap

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
pkoutsovasilis added a commit that referenced this pull request Jun 12, 2025
…s integration tests (#8456)

* [tests] split up serverless and resource leaks integration tests (#8396)

* fix: expose PreinstalledPackages

* fix: make groups.go importable

* feat: introduce new leak package for integration tests

* feat: introduce new serverless package for integration tests

* feat: incorporate serverless and extended runtime leak tests in mage

* fix: normalise powershell (windows) and bash (unix) integration tests invocation flow

* fix: use -test prefixed args for test-wise argument in buildkite-integration-tests.ps1

* fix: add comment about test timeout 2h0m0s

* fix: correct wording

* doc: add integration:TestServerless and update integration:TestForResourceLeaks in test-framework-dev-guide.md

* fix: return directly the test exit code for ps1 scripts

* fix: rename file that host TestMain to main_test.go

* fix: correct build tags for serverless integration tests package

* fix: leverage log.Fatalf in serverless/main_test.go

* feat: expand the BK log group on failure

* tmp: introduce artificial test failure to test buildkite logging group expansion

* Revert "tmp: introduce artificial test failure to test buildkite logging group expansion"

This reverts commit ee6bd63.

* fix: typo

* fix: remove redundant BK log group expansion

(cherry picked from commit 92e139c)

# Conflicts:
#	.buildkite/scripts/buildkite-integration-tests.sh
#	.buildkite/scripts/integration-tests.ps1
#	testing/integration/auditd_monitoring_test.go
#	testing/integration/fleetserver_test.go
#	testing/integration/network_traffic_monitoring_test.go
#	testing/integration/osquery_monitoring_test.go

* fix: resolve conflicts

* fix: remove irrelevant files

* fix: remove -integration.fips flag

* fix: point to the correct path for "fleet-server.json" in TestInstallFleetServerBootstrap

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
v1v added a commit that referenced this pull request Jun 12, 2025
…ts-oblt-cli

* feature/serverless-its-oblt-cli: (51 commits)
  as agreed let's move the group to the kb.integration pipeline
  Update .github/workflows/serverless-project.yml
  ci: invoke serverless integration tests package from BK
  github-actions: create a serverless project daily
  [tests] split up serverless and resource leaks integration tests (#8396)
  chore: Update to elastic/beats@dfdc12e33de0 (#8446)
  Lock upgrade marker (#8254)
  build(deps): bump github.com/elastic/elastic-agent-system-metrics from 0.11.12 to 0.11.13 (#8420)
  Add docker image name template and renamed fips cloud specs (#8429)
  buildkite(scripts): refactor common scripts (#8365)
  Use require.Eventually to try and address flakiness (#8421)
  Fix pre-command to support extended testing (#8418)
  [Automation] Bump Golang version to 1.24.4 (#8384)
  chore: Update to elastic/beats@aed2a8b768bd (#8423)
  [main][Automation] Update versions (#8425)
  Add Pipeline to deploy custom agent image for FIPS testing (#8035)
  ci: automatically update OTel components (#8288)
  [Automation] Bump VM Image version to 1749258065 (#8390)
  fix: increase context timeout to accommodate for slower machines in Test_checkForUnprivilegedVault (#8374)
  otel: add cumulativetodeltaprocessor to EDOT collector (#8372)
  ...
pkoutsovasilis added a commit that referenced this pull request Jun 12, 2025
…s integration tests (#8455)

* [tests] split up serverless and resource leaks integration tests (#8396)

* fix: expose PreinstalledPackages

* fix: make groups.go importable

* feat: introduce new leak package for integration tests

* feat: introduce new serverless package for integration tests

* feat: incorporate serverless and extended runtime leak tests in mage

* fix: normalise powershell (windows) and bash (unix) integration tests invocation flow

* fix: use -test prefixed args for test-wise argument in buildkite-integration-tests.ps1

* fix: add comment about test timeout 2h0m0s

* fix: correct wording

* doc: add integration:TestServerless and update integration:TestForResourceLeaks in test-framework-dev-guide.md

* fix: return directly the test exit code for ps1 scripts

* fix: rename file that host TestMain to main_test.go

* fix: correct build tags for serverless integration tests package

* fix: leverage log.Fatalf in serverless/main_test.go

* feat: expand the BK log group on failure

* tmp: introduce artificial test failure to test buildkite logging group expansion

* Revert "tmp: introduce artificial test failure to test buildkite logging group expansion"

This reverts commit ee6bd63.

* fix: typo

* fix: remove redundant BK log group expansion

(cherry picked from commit 92e139c)

# Conflicts:
#	.buildkite/scripts/buildkite-integration-tests.sh
#	.buildkite/scripts/integration-tests.ps1
#	testing/integration/auditd_monitoring_test.go
#	testing/integration/fleetserver_test.go
#	testing/integration/logs_ingestion_test.go
#	testing/integration/network_traffic_monitoring_test.go
#	testing/integration/osquery_monitoring_test.go

* fix: resolve conflicts

* fix: go fmt

* fix: remove irrelevant files

* fix: remove -integration.fips flag

* fix: point to the correct path for "fleet-server.json" in TestInstallFleetServerBootstrap

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-active-all Automated backport with mergify to all the active branches skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split up runtime resource leak integration tests into dedicated package Split up serverless integration tests into dedicated package
6 participants