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 serverless beats tests #3658

Merged
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
c55bbde
cleaning up
fearful-symmetry Aug 15, 2023
12ac235
Merge remote-tracking branch 'upstream/main' into serverless-tests
fearful-symmetry Aug 15, 2023
e939383
final bit of cleanup
fearful-symmetry Aug 16, 2023
2afe998
fix magefile, cleanup docs
fearful-symmetry Aug 16, 2023
413c0d7
clean up errors, make linter happy
fearful-symmetry Aug 16, 2023
a16767d
fix headers
fearful-symmetry Aug 16, 2023
7e8970a
fix fields in runner config
fearful-symmetry Aug 16, 2023
9e26b7c
add dashboard checks
fearful-symmetry Aug 17, 2023
3aab6e6
Merge remote-tracking branch 'upstream/main' into serverless-tests
fearful-symmetry Aug 17, 2023
369f62e
clean up, refactor
fearful-symmetry Aug 25, 2023
0b7afae
clean up
fearful-symmetry Aug 25, 2023
ef23b3a
tinker with env vars
fearful-symmetry Aug 28, 2023
a20930d
fix defaults in fixture
fearful-symmetry Aug 29, 2023
7d5da83
check binary name in test setup
fearful-symmetry Aug 29, 2023
e75b495
Merge remote-tracking branch 'upstream/main' into serverless-tests
fearful-symmetry Sep 5, 2023
85b4ba5
allow ilm override in tests
fearful-symmetry Sep 6, 2023
0051120
fix filebeat tests, add cleanup
fearful-symmetry Sep 6, 2023
fd88bf2
tinker with dashboards
fearful-symmetry Sep 11, 2023
ec9c8c5
fix ilm tests
fearful-symmetry Sep 13, 2023
e312d0b
Merge remote-tracking branch 'upstream/main' into serverless-tests
fearful-symmetry Sep 13, 2023
27f8814
Merge remote-tracking branch 'upstream/main' into serverless-tests
fearful-symmetry Sep 21, 2023
5611ff9
Merge remote-tracking branch 'origin/serverless-tests' into serverles…
fearful-symmetry Sep 21, 2023
8267e47
use API keys for auth
fearful-symmetry Sep 26, 2023
a733070
Merge remote-tracking branch 'origin/serverless-tests' into serverles…
fearful-symmetry Sep 26, 2023
acff625
add additional integration tests
fearful-symmetry Sep 27, 2023
3196a39
Merge remote-tracking branch 'upstream/main' into serverless-tests
fearful-symmetry Sep 28, 2023
a79b814
Merge remote-tracking branch 'upstream/main' into serverless-tests
fearful-symmetry Sep 28, 2023
de89941
remove beats-specific code
fearful-symmetry Sep 28, 2023
6a5277b
hack in serverless tests
fearful-symmetry Sep 29, 2023
a5039e6
tinker with tests
fearful-symmetry Sep 29, 2023
5a49c56
change env var naming
fearful-symmetry Sep 29, 2023
918fec6
actually use correct provisioner name
fearful-symmetry Sep 29, 2023
459206a
tinker with buildkite again
fearful-symmetry Oct 2, 2023
a7c0c0a
Merge remote-tracking branch 'upstream/main' into support-serverless-…
fearful-symmetry Oct 2, 2023
d158d76
fix things after refactor
fearful-symmetry Oct 3, 2023
b2e4e87
fix buildkite
fearful-symmetry Oct 3, 2023
f359ef0
fix my bash scripts
fearful-symmetry Oct 3, 2023
bf3e5f4
my bash is a tad rusty
fearful-symmetry Oct 3, 2023
1e00bd0
tinker with script hooks
fearful-symmetry Oct 3, 2023
203491c
not sure what ci role I broke
fearful-symmetry Oct 3, 2023
0903608
Merge remote-tracking branch 'upstream/main' into support-serverless-…
fearful-symmetry Oct 4, 2023
875bbd1
clean up es handlers
fearful-symmetry Oct 5, 2023
c1cadb1
Merge remote-tracking branch 'upstream/main' into support-serverless-…
fearful-symmetry Oct 5, 2023
2b0d84d
deal with recent refactor
fearful-symmetry Oct 5, 2023
8c07f05
fix my broken refactor
fearful-symmetry Oct 5, 2023
9edc32c
change url, see what happens
fearful-symmetry Oct 5, 2023
0c7d0cb
Merge remote-tracking branch 'upstream/main' into support-serverless-…
fearful-symmetry Oct 6, 2023
ea4d684
Merge remote-tracking branch 'upstream/main' into support-serverless-…
fearful-symmetry Oct 9, 2023
4fe9a58
Merge remote-tracking branch 'upstream/main' into support-serverless-…
fearful-symmetry Oct 10, 2023
c3c8255
tinker with tests more
fearful-symmetry Oct 10, 2023
0a0ea06
swap pipelines, see what happens
fearful-symmetry Oct 10, 2023
d9b62c0
Merge remote-tracking branch 'upstream/main' into support-serverless-…
fearful-symmetry Oct 10, 2023
4165bdb
break apart beat runners
fearful-symmetry Oct 11, 2023
1194e06
create test
fearful-symmetry Oct 12, 2023
c09e3f6
add more tests
fearful-symmetry Oct 12, 2023
bf89a85
override tests in progress
fearful-symmetry Oct 13, 2023
6dc7c94
finish overwrite tests
fearful-symmetry Oct 13, 2023
421e35f
still adding tests
fearful-symmetry Oct 16, 2023
ee2a073
Merge remote-tracking branch 'upstream/main' into add-beats-tests-to-…
fearful-symmetry Oct 25, 2023
99ac425
cleanup
fearful-symmetry Oct 25, 2023
a7f4383
fix env var names
fearful-symmetry Oct 25, 2023
d62781c
fix filebeat setup, test names
fearful-symmetry Oct 25, 2023
27f1701
fixing up filebeat
fearful-symmetry Oct 26, 2023
a590d3b
use templates, fix ES query
fearful-symmetry Oct 26, 2023
38775b1
tinker with buildkite
fearful-symmetry Oct 27, 2023
ac2d445
still tinkering
fearful-symmetry Oct 27, 2023
587def0
still trying to get it to work
fearful-symmetry Oct 27, 2023
3e0eb23
still trying to get it to work
fearful-symmetry Oct 27, 2023
94b3961
add script, see what happens
fearful-symmetry Oct 27, 2023
d8f17aa
tinkering with script
fearful-symmetry Oct 27, 2023
5cf68f5
tinkering with script
fearful-symmetry Oct 27, 2023
e9d8404
trying to diagnose buildkite
fearful-symmetry Oct 27, 2023
03d3705
still fighting with buildkite
fearful-symmetry Oct 27, 2023
18523dc
still trying to get it to work
fearful-symmetry Oct 27, 2023
8da7a0b
set workspace
fearful-symmetry Oct 27, 2023
40bea83
change workspace
fearful-symmetry Oct 27, 2023
4ad1f14
change workspace, again
fearful-symmetry Oct 27, 2023
77186df
change workspace, again
fearful-symmetry Oct 27, 2023
c6ce641
trying to debug buildkite
fearful-symmetry Oct 27, 2023
537c81f
Merge remote-tracking branch 'upstream/main' into add-beats-tests-to-…
fearful-symmetry Oct 30, 2023
03aabf9
add debug statements
fearful-symmetry Oct 30, 2023
48d6c5a
run mage twice
fearful-symmetry Oct 30, 2023
04d501d
I swear I'll figure this out
fearful-symmetry Oct 30, 2023
a81c543
potential script install issue?
fearful-symmetry Oct 30, 2023
75437d9
use different condition for if block
fearful-symmetry Oct 30, 2023
6bd9190
fix potential wrong flag in setup scripts
fearful-symmetry Oct 30, 2023
cdf67cf
change -p flag
fearful-symmetry Oct 30, 2023
a9ed68c
fix workspace path, add tests,remove debug code
fearful-symmetry Oct 30, 2023
478e357
use proper env vars
fearful-symmetry Oct 30, 2023
2bf8b9d
fix mage call, directories
fearful-symmetry Oct 30, 2023
860829c
set working directories
fearful-symmetry Oct 30, 2023
1c522ff
now trying to get auth working
fearful-symmetry Oct 30, 2023
c55b000
change name to make setup happy
fearful-symmetry Oct 30, 2023
f4f69ea
disable cleanup
fearful-symmetry Oct 31, 2023
1ad5919
re-enable cleanup
fearful-symmetry Oct 31, 2023
4823f2b
run one test at a time
fearful-symmetry Oct 31, 2023
ff33974
refactor, run filebeat
fearful-symmetry Oct 31, 2023
9664cb3
move function def
fearful-symmetry Oct 31, 2023
882bc6e
fix if blocks
fearful-symmetry Oct 31, 2023
af010c5
fix test run, add support for auditbeat and packetbeat
fearful-symmetry Oct 31, 2023
e5e7b69
add packetbeat support, run auditbeat tests
fearful-symmetry Oct 31, 2023
2b8f099
add serverless buildkite logic
fearful-symmetry Nov 1, 2023
97a60d4
add more documentation
fearful-symmetry Nov 1, 2023
b86305e
Merge remote-tracking branch 'upstream/main' into add-beats-tests-to-…
fearful-symmetry Nov 2, 2023
8454892
Merge remote-tracking branch 'upstream/main' into add-beats-tests-to-…
fearful-symmetry Nov 7, 2023
72567f4
Merge remote-tracking branch 'upstream/main' into add-beats-tests-to-…
fearful-symmetry Nov 8, 2023
48d7ea2
Merge remote-tracking branch 'upstream/main' into add-beats-tests-to-…
fearful-symmetry Nov 10, 2023
374cc74
Merge remote-tracking branch 'upstream/main' into add-beats-tests-to-…
fearful-symmetry Nov 13, 2023
fac8582
Merge remote-tracking branch 'upstream/main' into add-beats-tests-to-…
fearful-symmetry Nov 14, 2023
5cef809
fix up tests
fearful-symmetry Nov 16, 2023
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
25 changes: 25 additions & 0 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,31 @@ func (Integration) PrepareOnRemote() {
mg.Deps(mage.InstallGoTestTools)
}

// Run beat serverless tests
func (Integration) TestBeatServerless(ctx context.Context, beatname string) error {
beatBuildPath := filepath.Join("..", "beats", "x-pack", beatname, "build", "distributions")
err := os.Setenv("AGENT_BUILD_DIR", beatBuildPath)
if err != nil {
return fmt.Errorf("error setting build dir: %s", err)
}

// a bit of bypass logic; run as serverless by default
if os.Getenv("STACK_PROVISIONER") == "" {
err = os.Setenv("STACK_PROVISIONER", "serverless")
if err != nil {
return fmt.Errorf("error setting serverless stack var: %w", err)
}
} else if os.Getenv("STACK_PROVISIONER") == "stateful" {
fmt.Printf(">>> Warning: running TestBeatServerless as stateful\n")
pchila marked this conversation as resolved.
Show resolved Hide resolved
}

err = os.Setenv("TEST_BINARY_NAME", beatname)
if err != nil {
return fmt.Errorf("error setting binary name: %w", err)
}
return integRunner(ctx, false, "TestBeatsServerless")
}

// 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
4 changes: 3 additions & 1 deletion pkg/testing/ess/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
_ "embed"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strings"
Expand Down Expand Up @@ -195,7 +196,8 @@ func (c *Client) ShutdownDeployment(ctx context.Context, deploymentID string) er
defer res.Body.Close()

if res.StatusCode != 200 {
return fmt.Errorf("got unexpected response code [%d] from deployment shutdown API", res.StatusCode)
resp, _ := io.ReadAll(res.Body)
return fmt.Errorf("got unexpected response code [%d] from deployment shutdown API: %s", res.StatusCode, resp)
}

return nil
Expand Down
Loading
Loading