From 7c82c86a7ce3018ddc9fc5c65abceb2dc20bdf07 Mon Sep 17 00:00:00 2001 From: Pavel Zorin Date: Tue, 13 Aug 2024 16:12:37 +0200 Subject: [PATCH] [CI] Agentbeat integration testing (#40380) * [CI] Agentbeat integration testing * Split packaging and integration test * Fix artifacts path * Added NodeJS version * docker compose replace --no-ansi with --ansi never * Mistype * Removed metricbeat from agentbeat's GoIntegTest --- .../x-pack/pipeline.xpack.agentbeat.yml | 36 +++++++++++++++++++ libbeat/tests/compose/wrapper.go | 2 +- x-pack/agentbeat/magefile.go | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.buildkite/x-pack/pipeline.xpack.agentbeat.yml b/.buildkite/x-pack/pipeline.xpack.agentbeat.yml index a07a7c11dc8..daf4603d0c9 100644 --- a/.buildkite/x-pack/pipeline.xpack.agentbeat.yml +++ b/.buildkite/x-pack/pipeline.xpack.agentbeat.yml @@ -34,3 +34,39 @@ steps: notify: - github_commit_status: context: "agentbeat: Packaging" + + - label: ":linux: Agentbeat/Integration tests Linux" + key: "agentbeat-it-linux" + depends_on: + - agentbeat-package-linux + env: + ASDF_NODEJS_VERSION: 18.17.1 + PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64" + SNAPSHOT: true + command: | + set -euo pipefail + echo "~~~ Downloading artifacts" + buildkite-agent artifact download x-pack/agentbeat/build/distributions/** . --step 'agentbeat-package-linux' + ls -lah x-pack/agentbeat/build/distributions/ + echo "~~~ Installing @elastic/synthetics with npm" + npm install -g @elastic/synthetics + echo "~~~ Running tests" + cd x-pack/agentbeat + mage goIntegTest + artifact_paths: + - x-pack/agentbeat/build/distributions/**/* + - "x-pack/agentbeat/build/*.xml" + - "x-pack/agentbeat/build/*.json" + retry: + automatic: + - limit: 1 + timeout_in_minutes: 60 + agents: + provider: "gcp" + image: "${IMAGE_UBUNTU_X86_64}" + machineType: "${GCP_HI_PERF_MACHINE_TYPE}" + disk_size: 100 + disk_type: "pd-ssd" + notify: + - github_commit_status: + context: "agentbeat: Integration tests" diff --git a/libbeat/tests/compose/wrapper.go b/libbeat/tests/compose/wrapper.go index d5d51e3a0f8..e2c72cdff37 100644 --- a/libbeat/tests/compose/wrapper.go +++ b/libbeat/tests/compose/wrapper.go @@ -162,7 +162,7 @@ func (d *wrapperDriver) Close() error { func (d *wrapperDriver) cmd(ctx context.Context, command string, arg ...string) *exec.Cmd { args := make([]string, 0, 4+len(d.Files)+len(arg)) // preallocate as much as possible - args = append(args, "--no-ansi", "--project-name", d.Name) + args = append(args, "--ansi", "never", "--project-name", d.Name) for _, f := range d.Files { args = append(args, "--file", f) } diff --git a/x-pack/agentbeat/magefile.go b/x-pack/agentbeat/magefile.go index 4da9fdfd967..b65a3e59af3 100644 --- a/x-pack/agentbeat/magefile.go +++ b/x-pack/agentbeat/magefile.go @@ -204,7 +204,7 @@ func GoIntegTest(ctx context.Context) error { mg.Deps(BuildSystemTestBinary) args := devtools.DefaultGoTestIntegrationFromHostArgs() args.Tags = append(args.Tags, "agentbeat") - args.Packages = append(args.Packages, "../auditbeat/...", "../filebeat/...", "../heartbeat/...", "../metricbeat/...", "../osquerybeat/...", "../packetbeat/...") + args.Packages = append(args.Packages, "../auditbeat/...", "../filebeat/...", "../heartbeat/...", "../osquerybeat/...", "../packetbeat/...") return devtools.GoIntegTestFromHost(ctx, args) }