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

add extended runtime test #4150

Merged
merged 59 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
9516c4d
add extended runtime test
fearful-symmetry Jan 25, 2024
2f35dd8
fix build constraints
fearful-symmetry Jan 26, 2024
8261364
format
fearful-symmetry Jan 26, 2024
76d110a
linter
fearful-symmetry Jan 26, 2024
9507b44
add handle testing on windows
fearful-symmetry Jan 27, 2024
bb744e9
add ci target for extended test, see what happens
fearful-symmetry Jan 29, 2024
3121f29
rename test key
fearful-symmetry Jan 29, 2024
5cf5b39
increase default time
fearful-symmetry Jan 29, 2024
0ddd62b
Merge remote-tracking branch 'upstream/main' into longterm-test
fearful-symmetry Jan 30, 2024
d11ffaa
add check
fearful-symmetry Jan 30, 2024
66562ba
use shorter period settings
fearful-symmetry Feb 1, 2024
7c3d8fa
add apache tests
fearful-symmetry Feb 2, 2024
782cb40
Merge remote-tracking branch 'upstream/main' into longterm-test
fearful-symmetry Feb 2, 2024
e65e95d
first pass at derivatives
fearful-symmetry Feb 2, 2024
6aa6376
add test
fearful-symmetry Feb 2, 2024
c9ef865
use derivatives
fearful-symmetry Feb 5, 2024
a7baad5
make notice
fearful-symmetry Feb 5, 2024
8454ac0
change time
fearful-symmetry Feb 5, 2024
61aecbf
try to fix notice
fearful-symmetry Feb 5, 2024
c68be8f
add log line to watcher
fearful-symmetry Feb 5, 2024
4e38782
Merge remote-tracking branch 'origin/longterm-test' into longterm-test
fearful-symmetry Feb 5, 2024
61b8b51
add NaN check
fearful-symmetry Feb 5, 2024
a74483b
add more debug data
fearful-symmetry Feb 5, 2024
092de4e
fix math
fearful-symmetry Feb 5, 2024
c1ed753
fix calc errors
fearful-symmetry Feb 6, 2024
6e55f4e
fix test build
fearful-symmetry Feb 6, 2024
f4f4ce5
cleanup
fearful-symmetry Feb 6, 2024
acb1852
docs, cleanup
fearful-symmetry Feb 7, 2024
ae55962
use spigot, fixup errors
fearful-symmetry Feb 8, 2024
33a40f0
Merge remote-tracking branch 'upstream/main' into longterm-test
fearful-symmetry Feb 8, 2024
c31068f
use spigot, cef, elastic-agent events for fetching pids
fearful-symmetry Feb 8, 2024
776fda1
oops
fearful-symmetry Feb 8, 2024
55a9001
fighting with notice
fearful-symmetry Feb 8, 2024
c85fefc
fix ticker, tinker with other things
fearful-symmetry Feb 9, 2024
3ba8943
Merge remote-tracking branch 'upstream/main' into longterm-test
fearful-symmetry Feb 9, 2024
5a1f711
docs
fearful-symmetry Feb 12, 2024
bb6efd3
Merge remote-tracking branch 'upstream/main' into longterm-test
fearful-symmetry Feb 12, 2024
424f013
improve docs
fearful-symmetry Feb 12, 2024
3414c2b
Merge remote-tracking branch 'upstream/main' into longterm-test
fearful-symmetry Feb 12, 2024
1b9a083
fix gomod
fearful-symmetry Feb 12, 2024
8fb70fe
update notice
fearful-symmetry Feb 12, 2024
42cd14d
fix notice
fearful-symmetry Feb 12, 2024
e3e6c1b
refactor, use epr for package versions
fearful-symmetry Feb 13, 2024
95a0016
Merge remote-tracking branch 'origin/longterm-test' into longterm-test
fearful-symmetry Feb 13, 2024
49e7603
linter
fearful-symmetry Feb 13, 2024
70829b8
fix linter
fearful-symmetry Feb 13, 2024
49d880a
fixes for HTTP helpers
fearful-symmetry Feb 13, 2024
f74a3f8
use hard-coded versions
fearful-symmetry Feb 13, 2024
22b6fee
fix ctx
fearful-symmetry Feb 16, 2024
2862e0d
fighting with logs
fearful-symmetry Feb 16, 2024
1311cbe
Merge remote-tracking branch 'upstream/main' into longterm-test
fearful-symmetry Feb 16, 2024
0b5ed75
name changes, fighting with logs
fearful-symmetry Feb 20, 2024
8d6a7c4
Merge remote-tracking branch 'upstream/main' into longterm-test
fearful-symmetry Feb 20, 2024
85febe2
add tests, check logs
fearful-symmetry Feb 20, 2024
26efe1b
fix ci issues
fearful-symmetry Feb 20, 2024
3da2e2b
clean up
fearful-symmetry Feb 21, 2024
be4616f
oops
fearful-symmetry Feb 21, 2024
f7cbb98
cleanup, rename a few tings
fearful-symmetry Mar 5, 2024
eaab307
fix tags
fearful-symmetry Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ steps:
provider: "gcp"
machineType: "n1-standard-8"

- label: "Extended runtime tests"
key: "extended-integration-tests"
command: ".buildkite/scripts/steps/integration_tests.sh stateful integration:TestExtendedRuntime"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
command: ".buildkite/scripts/steps/integration_tests.sh stateful integration:TestExtendedRuntime"
command: ".buildkite/scripts/steps/integration_tests.sh stateful integration: TestLongRunningAgentForLeaks"

artifact_paths:
- "build/TEST-**"
- "build/diagnostics/*"
agents:
provider: "gcp"
machineType: "n1-standard-8"

- label: "Integration tests"
key: "integration-tests"
command: ".buildkite/scripts/steps/integration_tests.sh stateful"
Expand Down
4,784 changes: 4,596 additions & 188 deletions NOTICE.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev-tools/mage/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func TestPackages(options ...TestPackagesOption) error {
if mg.Verbose() {
fmt.Println(out)
}
return err
return fmt.Errorf("error running package_test.go: %w, stdout: %s", err, out)
}

return nil
Expand Down
2 changes: 2 additions & 0 deletions dev-tools/notice/overrides.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{"name": "github.com/leehinman/spigot", "licenceType": "Elastic"}
{"name": "github.com/elastic/elastic-agent-shipper-client", "licenceType": "Elastic"}
{"name": "github.com/elastic/beats/v7", "licenceType": "Elastic"}
{"name": "github.com/elastic/elastic-agent-client/v7", "licenceType": "Elastic"}
{"name": "github.com/elastic/e2e-testing", "licenceType": "Elastic"}
Expand Down
5 changes: 5 additions & 0 deletions docs/test-framework-dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ We pass a `-test.count` flag along with the name match
We pass a `-test.run` flag along with the names of the tests we want to run in OR
`GOTEST_FLAGS="-test.run ^(TestStandaloneUpgrade|TestFleetManagedUpgrade)$" mage integration:test`

##### Run Extended Runtime test
The test framework includes a "long running" test to check for resource leaks and stability.
The runtime of the test can be set via the `LONG_TEST_RUNTIME` environment variable.
The test itself can be run via the `integration:TestExtendedRuntime` mage target.

##### Limitations
Due to the way the parameters are passed to `devtools.GoTest` the value of the environment variable
is split on space, so not all combination of flags and their values may be correctly split.
Expand Down
26 changes: 25 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ require (
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901
github.com/josephspurrier/goversioninfo v0.0.0-20190209210621-63e6d1acd3dd
github.com/kardianos/service v1.2.1-0.20210728001519-a323c3813bc7
github.com/leehinman/spigot v0.0.0-20230530144131-c5a179785123
github.com/magefile/mage v1.15.0
github.com/mitchellh/gox v1.0.1
github.com/mitchellh/hashstructure v1.1.0
Expand All @@ -50,6 +51,7 @@ require (
github.com/pierrre/gotestcover v0.0.0-20160517101806-924dca7d15f0
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.27.0
github.com/sajari/regression v1.0.1
github.com/schollz/progressbar/v3 v3.13.1
github.com/shirou/gopsutil/v3 v3.23.12
github.com/sirupsen/logrus v1.9.3
Expand Down Expand Up @@ -102,6 +104,26 @@ require (
github.com/akavel/rsrc v0.8.0 // indirect
github.com/alecthomas/participle/v2 v2.1.1 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/aws/aws-sdk-go v1.44.158 // indirect
github.com/aws/aws-sdk-go-v2 v1.17.2 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.4 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.4 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.43 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.17 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.21 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.20 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.11.26 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.17.6 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
github.com/cavaliercoder/badio v0.0.0-20160213150051-ce5280129e9e // indirect
Expand All @@ -112,6 +134,7 @@ require (
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.7+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/elastic/elastic-agent-shipper-client v0.5.1-0.20230301154434-a10074360f12 // indirect
github.com/elastic/go-structform v0.0.10 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
Expand All @@ -134,7 +157,7 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0 // indirect
github.com/google/licenseclassifier v0.0.0-20221004142553-c1ed8fcf4bab // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand All @@ -145,6 +168,7 @@ require (
github.com/influxdata/go-syslog/v3 v3.0.1-0.20230911200830-875f5bc594a4 // indirect
github.com/jaypipes/pcidb v1.0.0 // indirect
github.com/jcchavezs/porto v0.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/klauspost/compress v1.17.4 // indirect
Expand Down
52 changes: 51 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,46 @@ github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:W
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
github.com/aws/aws-sdk-go v1.43.16/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go v1.44.158 h1:Q71ei9ijL3KuyQcLJA9TtuYy2gMLsLdVH5Q2ackBq3s=
github.com/aws/aws-sdk-go v1.44.158/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go-v2 v1.17.2 h1:r0yRZInwiPBNpQ4aDy/Ssh3ROWsGtKDwar2JS8Lm+N8=
github.com/aws/aws-sdk-go-v2 v1.17.2/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 h1:dK82zF6kkPeCo8J1e+tGx4JdvDIQzj7ygIoLg8WMuGs=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10/go.mod h1:VeTZetY5KRJLuD/7fkQXMU6Mw7H5m/KP2J5Iy9osMno=
github.com/aws/aws-sdk-go-v2/config v1.18.4 h1:VZKhr3uAADXHStS/Gf9xSYVmmaluTUfkc0dcbPiDsKE=
github.com/aws/aws-sdk-go-v2/config v1.18.4/go.mod h1:EZxMPLSdGAZ3eAmkqXfYbRppZJTzFTkv8VyEzJhKko4=
github.com/aws/aws-sdk-go-v2/credentials v1.13.4 h1:nEbHIyJy7mCvQ/kzGG7VWHSBpRB4H6sJy3bWierWUtg=
github.com/aws/aws-sdk-go-v2/credentials v1.13.4/go.mod h1:/Cj5w9LRsNTLSwexsohwDME32OzJ6U81Zs33zr2ZWOM=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20 h1:tpNOglTZ8kg9T38NpcGBxudqfUAwUzyUnLQ4XSd0CHE=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20/go.mod h1:d9xFpWd3qYwdIXM0fvu7deD08vvdRXyc/ueV+0SqaWE=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.43 h1:+bkAMTd5OGyHu2nwNOangjEsP65fR0uhMbZJA52sZ64=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.43/go.mod h1:sS2tu0VEspKuY5eM1vQgy7P/hpZX8F62o6qsghZExWc=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26 h1:5WU31cY7m0tG+AiaXuXGoMzo2GBQ1IixtWa8Yywsgco=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26/go.mod h1:2E0LdbJW6lbeU4uxjum99GZzI0ZjDpAb0CoSCM0oeEY=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20 h1:WW0qSzDWoiWU2FS5DbKpxGilFVlCEJPwx4YtjdfI0Jw=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20/go.mod h1:/+6lSiby8TBFpTVXZgKiN/rCfkYXEGvhlM4zCgPpt7w=
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27 h1:N2eKFw2S+JWRCtTt0IhIX7uoGGQciD4p6ba+SJv4WEU=
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27/go.mod h1:RdwFVc7PBYWY33fa2+8T1mSqQ7ZEK4ILpM0wfioDC3w=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.17 h1:5tXbMJ7Jq0iG65oiMg6tCLsHkSaO2xLXa2EmZ29vaTA=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.17/go.mod h1:twV0fKMQuqLY4klyFH56aXNq3AFiA5LO0/frTczEOFE=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 h1:y2+VQzC6Zh2ojtV2LoC0MNwHWc6qXv/j2vrQtlftkdA=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11/go.mod h1:iV4q2hsqtNECrfmlXyord9u4zyuFEJX9eLgLpSPzWA8=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.21 h1:77b1GfaSuIok5yB/3HYbG+ypWvOJDQ2rVdq943D17R4=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.21/go.mod h1:sPOz31BVdqeeurKEuUpLNSve4tdCNPluE+070HNcEHI=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20 h1:jlgyHbkZQAgAc7VIxJDmtouH8eNjOk2REVAQfVhdaiQ=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20/go.mod h1:Xs52xaLBqDEKRcAfX/hgjmD3YQ7c/W+BEyfamlO/W2E=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.20 h1:4K6dbmR0mlp3o4Bo78PnpvzHtYAqEeVMguvEenpMGsI=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.20/go.mod h1:1XpDcReIEOHsjwNToDKhIAO3qwLo1BnfbtSqWJa8j7g=
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.5 h1:nRSEQj1JergKTVc8RGkhZvOEGgcvo4fWpDPwGDeg2ok=
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.5/go.mod h1:wcaJTmjKFDW0s+Se55HBNIds6ghdAGoDDw+SGUdrfAk=
github.com/aws/aws-sdk-go-v2/service/sso v1.11.26 h1:ActQgdTNQej/RuUJjB9uxYVLDOvRGtUreXF8L3c8wyg=
github.com/aws/aws-sdk-go-v2/service/sso v1.11.26/go.mod h1:uB9tV79ULEZUXc6Ob18A46KSQ0JDlrplPni9XW6Ot60=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9 h1:wihKuqYUlA2T/Rx+yu2s6NDAns8B9DgnRooB1PVhY+Q=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9/go.mod h1:2E/3D/mB8/r2J7nK42daoKP/ooCwbf0q1PznNc+DZTU=
github.com/aws/aws-sdk-go-v2/service/sts v1.17.6 h1:VQFOLQVL3BrKM/NLO/7FiS4vcp5bqK0mGMyk09xLoAY=
github.com/aws/aws-sdk-go-v2/service/sts v1.17.6/go.mod h1:Az3OXXYGyfNwQNsK/31L4R75qFYnO641RZGAoV3uH1c=
github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8=
github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/aymerick/raymond v2.0.2+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
Expand Down Expand Up @@ -802,6 +842,8 @@ github.com/elastic/elastic-agent-client/v7 v7.8.0 h1:GHFzDJIWpdgI0qDk5EcqbQJGvwT
github.com/elastic/elastic-agent-client/v7 v7.8.0/go.mod h1:ihtjqJzYiIltlRhNruaSSc0ogxIhqPD5hOMKq16cI1s=
github.com/elastic/elastic-agent-libs v0.7.5 h1:4UMqB3BREvhwecYTs/L23oQp1hs/XUkcunPlmTZn5yg=
github.com/elastic/elastic-agent-libs v0.7.5/go.mod h1:pGMj5myawdqu+xE+WKvM5FQzKQ/MonikkWOzoFTJxaU=
github.com/elastic/elastic-agent-shipper-client v0.5.1-0.20230301154434-a10074360f12 h1:6otnvaYs4+6S9Xw332vBjMrAQdkaT9kRnyO0flEfC6A=
github.com/elastic/elastic-agent-shipper-client v0.5.1-0.20230301154434-a10074360f12/go.mod h1:rWarFM7qYxJKsi9WcV6ONcFjH/NA3niDNpTxO+8/GVI=
github.com/elastic/elastic-agent-system-metrics v0.9.1 h1:r0ofKHgPpl+W09ie7tzGcCDC0d4NZbQUv37rSgHf4FM=
github.com/elastic/elastic-agent-system-metrics v0.9.1/go.mod h1:9C1UEfj0P687HAzZepHszN6zXA+2tN2Lx3Osvq1zby8=
github.com/elastic/elastic-integration-corpus-generator-tool v0.5.0/go.mod h1:uf9N86y+UACGybdEhZLpwZ93XHWVhsYZAA4c2T2v6YM=
Expand Down Expand Up @@ -1075,8 +1117,10 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0 h1:OggOMmdI0JLwg1FkOKH9S7fVHF0oEm8PX6S8kAdpOps=
github.com/google/licenseclassifier v0.0.0-20200402202327-879cb1424de0/go.mod h1:qsqn2hxC+vURpyBRygGUuinTO42MFRLcsmQ/P8v94+M=
github.com/google/licenseclassifier v0.0.0-20221004142553-c1ed8fcf4bab h1:okY7fFoWybMbxiHkaqStN4mxSrPfYmTZl5Zh32Z5FjY=
github.com/google/licenseclassifier v0.0.0-20221004142553-c1ed8fcf4bab/go.mod h1:jkYIPv59uiw+1MxTWlqQEKebsUDV1DCXQtBBn5lVzf4=
github.com/google/licenseclassifier/v2 v2.0.0-alpha.1/go.mod h1:YAgBGGTeNDMU+WfIgaFvjZe4rudym4f6nIn8ZH5X+VM=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
Expand Down Expand Up @@ -1249,7 +1293,9 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ=
github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8=
Expand Down Expand Up @@ -1324,6 +1370,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o=
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw=
github.com/leehinman/spigot v0.0.0-20230530144131-c5a179785123 h1:b8CmvhduKrluIe4/8kZinMqspsn4uEeEs9v0vXNOkXc=
github.com/leehinman/spigot v0.0.0-20230530144131-c5a179785123/go.mod h1:21+9JKf7FFRDI90x9m0IFVeTogEh7dSQ/dxfZteDcKY=
github.com/leodido/ragel-machinery v0.0.0-20181214104525-299bdde78165 h1:bCiVCRCs1Heq84lurVinUPy19keqGEe4jh5vtK37jcg=
github.com/leodido/ragel-machinery v0.0.0-20181214104525-299bdde78165/go.mod h1:WZxr2/6a/Ar9bMDc2rN/LJrE/hF6bXE4LPyDSIxwAfg=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
Expand Down Expand Up @@ -1704,6 +1752,8 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
github.com/sagikazarmark/crypt v0.9.0/go.mod h1:RnH7sEhxfdnPm1z+XMgSLjWTEIjyK4z2dw6+4vHTMuo=
github.com/sajari/regression v1.0.1 h1:iTVc6ZACGCkoXC+8NdqH5tIreslDTT/bXxT6OmHR5PE=
github.com/sajari/regression v1.0.1/go.mod h1:NeG/XTW1lYfGY7YV/Z0nYDV/RGh3wxwd1yW46835flM=
github.com/santhosh-tekuri/jsonschema v1.2.4 h1:hNhW8e7t+H1vgY+1QeEQpveR6D4+OwKPXCfD2aieJis=
github.com/santhosh-tekuri/jsonschema v1.2.4/go.mod h1:TEAUOeZSmIxTTuHatJzrvARHiuO9LYd+cIxzgEHCQI4=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
Expand Down
11 changes: 11 additions & 0 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,14 @@ func (Integration) TestBeatServerless(ctx context.Context, beatname string) erro
return integRunner(ctx, false, "TestBeatsServerless")
}

func (Integration) TestExtendedRuntime(ctx context.Context) error {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func (Integration) TestExtendedRuntime(ctx context.Context) error {
func (Integration) TestLongRunningAgentForLeaks(ctx context.Context) error {

The target name should match what it actually does.

Copy link
Member

Choose a reason for hiding this comment

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

This wasn't actually changed.

err := os.Setenv("TEST_LONG_RUNNING", "true")
if err != nil {
return fmt.Errorf("error setting TEST_LONG_RUNNING: %w", err)
}
return integRunner(ctx, false, "TestLongRunningAgentForLeaks")
}

// TestOnRemote shouldn't be called locally (called on remote host to perform testing)
func (Integration) TestOnRemote(ctx context.Context) error {
mg.Deps(Build.TestBinaries)
Expand Down Expand Up @@ -2176,6 +2184,9 @@ func createTestRunner(matrix bool, singleTest string, goTestFlags string, batche
extraEnv["AGENT_KEEP_INSTALLED"] = os.Getenv("AGENT_KEEP_INSTALLED")
}

extraEnv["TEST_LONG_RUNNING"] = os.Getenv("TEST_LONG_RUNNING")
extraEnv["LONG_TEST_RUNTIME"] = os.Getenv("LONG_TEST_RUNTIME")

// these following two env vars are currently not used by anything, but can be used in the future to test beats or
// other binaries, see https://github.com/elastic/elastic-agent/pull/3258
binaryName := os.Getenv("TEST_BINARY_NAME")
Expand Down
7 changes: 5 additions & 2 deletions pkg/testing/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,10 @@ func (f *Fixture) ExecStatus(ctx context.Context, opts ...process.CmdOption) (Ag
}, uerr))
}

return status, err
if err != nil {
return status, fmt.Errorf("error running command (output: %s): %w", string(out), err)
}
return status, nil
}

// ExecInspect executes to inspect subcommand on the prepared Elastic Agent binary.
Expand Down Expand Up @@ -777,7 +780,7 @@ func (f *Fixture) ExecDiagnostics(ctx context.Context, cmd ...string) (string, e
func (f *Fixture) IsHealthy(ctx context.Context, opts ...process.CmdOption) error {
status, err := f.ExecStatus(ctx, opts...)
if err != nil {
return fmt.Errorf("agent status returned and error: %w", err)
return fmt.Errorf("agent status returned an error: %w", err)
}

if status.State != int(cproto.State_HEALTHY) {
Expand Down
57 changes: 57 additions & 0 deletions pkg/testing/tools/epr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package tools

import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
)

const eprProd = "https://epr.elastic.co"

// / PackageSearchResult contains basic info on a package returned by a search
type PackageSearchResult struct {
Name string `json:"name"`
Version string `json:"version"`
Release string `json:"release"`
Path string `json:"path"`
}

// GetLatestPackageRelease returns the version string of the latest package release
func GetLatestPackageRelease(ctx context.Context, packageName string) (string, error) {
endpoint := fmt.Sprintf("%s/search?package=%s&all=false", eprProd, packageName)
req, err := http.NewRequestWithContext(ctx, "GET", endpoint, nil)
if err != nil {
return "", fmt.Errorf("error creating HTTP request: %w", err)
}
resp, err := http.DefaultClient.Do(req) //nolint:gosec,nolintlint // it's a test
//create body before we check for errors, easier to format error strings that way
body, errRead := io.ReadAll(resp.Body)
if errRead != nil {
return "", fmt.Errorf("error reading body of HTTP resp: %w", err)
}
resp.Body.Close()
if err != nil {
return "", fmt.Errorf("failed to create search request for EPR (%s): %w", body, err)
}
if resp.StatusCode >= 300 {
return "", fmt.Errorf("non-2xx status code from EPR")
}

parsedResp := []PackageSearchResult{}
err = json.Unmarshal(body, &parsedResp)
if err != nil {
return "", fmt.Errorf("error parsing search response: %w", err)
}
// if we set &all=false, we'll get at most one result
if len(parsedResp) < 1 {
return "", fmt.Errorf("no packages matching '%s' found", packageName)
}

return parsedResp[0].Version, nil
}
Loading
Loading