-
Notifications
You must be signed in to change notification settings - Fork 198
[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
pkoutsovasilis
merged 21 commits into
elastic:main
from
pkoutsovasilis:feat/split_up_integration_tests
Jun 11, 2025
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b6a782b
fix: expose PreinstalledPackages
pkoutsovasilis 5cb57a7
fix: make groups.go importable
pkoutsovasilis 35869d9
feat: introduce new leak package for integration tests
pkoutsovasilis f91b367
feat: introduce new serverless package for integration tests
pkoutsovasilis 4058895
feat: incorporate serverless and extended runtime leak tests in mage
pkoutsovasilis 8484c1e
fix: normalise powershell (windows) and bash (unix) integration tests…
pkoutsovasilis 11f6cf1
fix: use -test prefixed args for test-wise argument in buildkite-inte…
pkoutsovasilis a0ed6f1
fix: add comment about test timeout 2h0m0s
pkoutsovasilis 4dbfd5f
fix: correct wording
pkoutsovasilis f4f395c
doc: add integration:TestServerless and update integration:TestForRes…
pkoutsovasilis a2a072d
fix: return directly the test exit code for ps1 scripts
pkoutsovasilis 919d25a
fix: rename file that host TestMain to main_test.go
pkoutsovasilis 7f12158
fix: correct build tags for serverless integration tests package
pkoutsovasilis 2e7352b
Merge branch 'main' into feat/split_up_integration_tests
pkoutsovasilis 2df4ac3
fix: leverage log.Fatalf in serverless/main_test.go
pkoutsovasilis 907167b
Merge branch 'main' into feat/split_up_integration_tests
pkoutsovasilis fa9657c
feat: expand the BK log group on failure
pkoutsovasilis ee6bd63
tmp: introduce artificial test failure to test buildkite logging grou…
pkoutsovasilis 37fa780
Revert "tmp: introduce artificial test failure to test buildkite logg…
pkoutsovasilis 0b85587
fix: typo
pkoutsovasilis f088a5f
fix: remove redundant BK log group expansion
pkoutsovasilis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| param( | ||
| [string]$GROUP_NAME, | ||
| [string]$TEST_SUDO | ||
| ) | ||
|
|
||
| if (-not $GROUP_NAME) | ||
| { | ||
| Write-Error "Error: Specify the group name: buildkite-integration-tests.ps1 <group_name> <true|false>" | ||
| exit 1 | ||
| } | ||
|
|
||
| if (-not $TEST_SUDO) | ||
| { | ||
| Write-Error "Error: Specify the test sudo: buildkite-integration-tests.ps1 <group_name> <true|false>" | ||
| exit 1 | ||
| } | ||
|
|
||
| if (-not $env:TEST_PACKAGE) | ||
| { | ||
| $env:TEST_PACKAGE = "github.com/elastic/elastic-agent/testing/integration" | ||
| } | ||
|
|
||
| # TODO: make is not available on Windows yet hence we cannot use make install-gotestsum | ||
| go install gotest.tools/gotestsum | ||
| gotestsum --version | ||
|
|
||
| $env:TEST_BINARY_NAME = "elastic-agent" | ||
| # Parsing version.go. Will be simplified here: https://github.com/elastic/ingest-dev/issues/4925 | ||
| $AGENT_VERSION = (Get-Content version/version.go | Select-String -Pattern 'const defaultBeatVersion =' | ForEach-Object { $_ -replace '.*?"(.*?)".*', '$1' }) | ||
| $env:AGENT_VERSION = $AGENT_VERSION + "-SNAPSHOT" | ||
|
|
||
| Write-Output "~~~ Agent version: $env:AGENT_VERSION" | ||
| $env:SNAPSHOT = $true | ||
|
|
||
| Write-Host "~~~ Running integration tests as $env:USERNAME" | ||
|
|
||
| $osInfo = (Get-CimInstance Win32_OperatingSystem).Caption + " " + (Get-CimInstance Win32_OperatingSystem).OSArchitecture -replace " ", "_" | ||
| $root_suffix = "" | ||
| if ($TEST_SUDO -eq "true") | ||
| { | ||
| $root_suffix = "_sudo" | ||
| } | ||
| $fully_qualified_group_name = "${GROUP_NAME}${root_suffix}_${osInfo}" | ||
| $outputXML = "build/${fully_qualified_group_name}.integration.xml" | ||
| $outputJSON = "build/${fully_qualified_group_name}.integration.out.json" | ||
|
|
||
| $TestsExitCode = 0 | ||
|
|
||
| try | ||
| { | ||
| Write-Output "~~~ Integration tests: $GROUP_NAME as user: $env:USERNAME" | ||
| # -test.timeout=2h0m0s is set because some tests normally take up to 45 minutes. | ||
| # This 2-hour timeout provides enough room for future, potentially longer tests, | ||
| # while still enforcing a reasonable upper limit on total execution time. | ||
| # See: https://pkg.go.dev/cmd/go#hdr-Testing_flags | ||
| $gotestArgs = @("-tags=integration", "-test.shuffle=on", "-test.timeout=2h0m0s", "$env:TEST_PACKAGE", "-v", "-args", "-integration.groups=$GROUP_NAME", "-integration.sudo=$TEST_SUDO") | ||
| & gotestsum --no-color -f standard-quiet --junitfile-hide-skipped-tests --junitfile "${outputXML}" --jsonfile "${outputJSON}" -- @gotestArgs | ||
| $TestsExitCode = $LASTEXITCODE | ||
pkoutsovasilis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if ($TestsExitCode -ne 0) | ||
| { | ||
| Write-Output "^^^ +++" | ||
| Write-Output "Integration tests failed" | ||
| } | ||
| } | ||
| finally | ||
| { | ||
| if (Test-Path $outputXML) | ||
| { | ||
| # Install junit2html if not installed | ||
| go install github.com/alexec/junit2html@latest | ||
| Get-Content $outputXML | junit2html > "build/TEST-report.html" | ||
| } | ||
| else | ||
| { | ||
| Write-Output "Cannot generate HTML test report: $outputXML not found" | ||
| } | ||
| } | ||
|
|
||
| exit $TestsExitCode | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| param ( | ||
| [string]$GROUP_NAME, | ||
| [string]$TEST_SUDO | ||
| ) | ||
|
|
||
| Write-Output "~~~ Preparing environment" | ||
|
|
||
| $PSVersionTable.PSVersion | ||
|
|
||
| . "$PWD\.buildkite\scripts\steps\ess.ps1" | ||
|
|
||
| # Read package version from .package-version file | ||
| $PACKAGE_VERSION = Get-Content .package-version -ErrorAction SilentlyContinue | ||
| if ($PACKAGE_VERSION) { | ||
| $PACKAGE_VERSION = "${PACKAGE_VERSION}-SNAPSHOT" | ||
| } | ||
|
|
||
| Write-Output "~~~ Building test binaries" | ||
| & mage build:testBinaries | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Output "^^^ +++" | ||
| Write-Output "Failed to build test binaries" | ||
| exit 1 | ||
| } | ||
|
|
||
| $TestsExitCode = 0 | ||
| try { | ||
| Write-Output "~~~ Running integration tests" | ||
| # Get-Ess-Stack will start the ESS stack if it is a BK retry, otherwise it will retrieve ESS stack metadata | ||
| Get-Ess-Stack -StackVersion $PACKAGE_VERSION | ||
| & "$PWD\.buildkite\scripts\buildkite-integration-tests.ps1" $GROUP_NAME $TEST_SUDO | ||
| $TestsExitCode = $LASTEXITCODE | ||
dliappis marked this conversation as resolved.
Show resolved
Hide resolved
pkoutsovasilis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if ($TestsExitCode -ne 0) | ||
| { | ||
| Write-Output "^^^ +++" | ||
| Write-Output "Integration tests failed" | ||
| } | ||
| } finally { | ||
| # ess_down will destroy the ESS stack if tf state file is found, aka if this is a BK retry | ||
| ess_down | ||
| } | ||
|
|
||
| exit $TestsExitCode | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.