Skip to content

[9.0] (backport #8396) [tests] split up serverless and resource leaks integration tests #8458

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
merged 3 commits into from
Jun 12, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jun 11, 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


This is an automatic backport of pull request #8396 done by [Mergify](https://mergify.com).

* 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
@mergify mergify bot added backport conflicts There is a conflict in the backported pull request labels Jun 11, 2025
@mergify mergify bot requested review from a team as code owners June 11, 2025 17:45
Copy link
Contributor Author

mergify bot commented Jun 11, 2025

Cherry-pick of 92e139c has failed:

On branch mergify/bp/9.0/pr-8396
Your branch is up to date with 'origin/9.0'.

You are currently cherry-picking commit 92e139ca2.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   .buildkite/bk.integration.pipeline.yml
	modified:   .buildkite/integration.pipeline.yml
	new file:   .buildkite/scripts/buildkite-integration-tests.ps1
	new file:   .buildkite/scripts/steps/integration_tests_tf.ps1
	modified:   .buildkite/scripts/steps/integration_tests_tf.sh
	modified:   docs/test-framework-dev-guide.md
	modified:   magefile.go
	modified:   pkg/testing/define/parser.go
	modified:   testing/integration/endpoint_test_tools.go
	modified:   testing/integration/fleetserver_test.go
	renamed:    testing/integration/groups_test.go -> testing/integration/groups.go
	modified:   testing/integration/init.go
	renamed:    testing/integration/agent_long_running_leak_test.go -> testing/integration/leak/long_running_test.go
	new file:   testing/integration/leak/main_test.go
	renamed:    testing/integration/agent_long_test_apache.json -> testing/integration/leak/testdata/agent_long_test_apache.json
	renamed:    testing/integration/agent_long_test_base_system_integ.json -> testing/integration/leak/testdata/agent_long_test_base_system_integ.json
	new file:   testing/integration/logs_ingestion.go
	modified:   testing/integration/logs_ingestion_test.go
	modified:   testing/integration/metrics_monitoring_test.go
	modified:   testing/integration/monitoring_probe_preserve_text_cfg_test.go
	modified:   testing/integration/monitoring_probe_reload_test.go
	new file:   testing/integration/serverless/logs_ingestion_test.go
	new file:   testing/integration/serverless/main_test.go

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   .buildkite/scripts/buildkite-integration-tests.sh
	deleted by them: .buildkite/scripts/integration-tests.ps1
	both modified:   testing/integration/auditd_monitoring_test.go
	both modified:   testing/integration/network_traffic_monitoring_test.go
	both modified:   testing/integration/osquery_monitoring_test.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot requested review from michalpristas and swiatekm and removed request for a team June 11, 2025 17:45
@github-actions github-actions bot added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog labels Jun 11, 2025
@elasticmachine
Copy link
Collaborator

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

@pkoutsovasilis
Copy link
Contributor

let's wait for the CI run on main to finish (92e139c), I want to be extra careful before merging this backport 🙂

Copy link

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @pkoutsovasilis

@pkoutsovasilis pkoutsovasilis merged commit 19098bc into 9.0 Jun 12, 2025
11 checks passed
@pkoutsovasilis pkoutsovasilis deleted the mergify/bp/9.0/pr-8396 branch June 12, 2025 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport conflicts There is a conflict in the backported pull request 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.

2 participants