=== RUN TestEndpointAgentServiceMonitoring
monitoring_endpoint_test.go:64: Enrolling the agent in Fleet
tools.go:104: Creating enrollment API key...
tools.go:95: Creating enrollment API key...
fixture_install.go:199: [test TestEndpointAgentServiceMonitoring] Inside fixture install function
fixture_install.go:227: [test TestEndpointAgentServiceMonitoring] Inside fixture installNoPkgManager function
fixture.go:290: Extracting artifact elastic-agent-9.0.0-SNAPSHOT-linux-x86_64.tar.gz to /tmp/TestEndpointAgentServiceMonitoring33601672
fixture.go:308: Completed extraction of artifact elastic-agent-9.0.0-SNAPSHOT-linux-x86_64.tar.gz to /tmp/TestEndpointAgentServiceMonitoring33601672
fixture.go:908: Components were not modified from the fetched artifact
fixture.go:665: >> running binary with: [/tmp/TestEndpointAgentServiceMonitoring33601672/elastic-agent-9.0.0-SNAPSHOT-linux-x86_64/elastic-agent install --force --non-interactive --url https://7c5f5e0e8f01b9dd08f1f88498fdf04a.fleet.us-west2.gcp.elastic-cloud.com:443 --enrollment-token WWVrQllwVUI0Q0J5MWlMM1pucjQ6UFZGSG5OWlg3dk9GMmJHTmlBdkdvUQ==]
tools.go:95: >>> Enroll succeeded. Output: Installing in non-interactive mode.
[ ] Copying install files [0s]
[ ===] Successfully copied files [2s]
[ ===] Installing service [2s]
[ =] Installed service [3s]
[ =] Starting Service [3s]
[ ==] Service Started [3s] Elastic Agent successfully installed, starting enrollment.
[ ==] Enrolling Elastic Agent with Fleet [3s]
[ ==] Waiting For Enroll... [3s] {"log.level":"info","@timestamp":"2025-03-04T16:33:51.628Z","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.(*enrollCmd).enrollWithBackoff","file.name":"cmd/enroll_cmd.go","file.line":524},"message":"Starting enrollment to URL: https://7c5f5e0e8f01b9dd08f1f88498fdf04a.fleet.us-west2.gcp.elastic-cloud.com:443/","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2025-03-04T16:33:53.179Z","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.(*enrollCmd).daemonReloadWithBackoff","file.name":"cmd/enroll_cmd.go","file.line":487},"message":"Restarting agent daemon, attempt 0","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2025-03-04T16:33:53.181Z","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.(*enrollCmd).Execute","file.name":"cmd/enroll_cmd.go","file.line":305},"message":"Successfully triggered restart on running Elastic Agent.","ecs.version":"1.6.0"}
Successfully enrolled the Elastic Agent.
[= ] Enroll Completed [5s]
[= ] Done [5s]
[= ] Done [5s]
Elastic Agent has been successfully installed.
monitoring_endpoint_test.go:87: Installing Elastic Defend
monitoring_endpoint_test.go:88: Templating endpoint package policy request
monitoring_endpoint_test.go:88: POST /api/fleet/package_policies
monitoring_endpoint_test.go:88: Error installing fleet package: Unable to remove package with existing package policy(s) in use by agent(s)
monitoring_endpoint_test.go:89:
Error Trace: /opt/buildkite-agent/builds/bk-agent-prod-gcp-1741105630137925843/elastic/elastic-agent/testing/integration/monitoring_endpoint_test.go:89
/opt/buildkite-agent/.asdf/installs/golang/1.23.6/packages/pkg/mod/github.com/stretchr/testify@v1.10.0/suite/suite.go:157
/opt/buildkite-agent/builds/bk-agent-prod-gcp-1741105630137925843/elastic/elastic-agent/testing/integration/monitoring_endpoint_test.go:56
Error: Received unexpected error:
error installing fleet package: Unable to remove package with existing package policy(s) in use by agent(s)
Test: TestEndpointAgentServiceMonitoring
Messages: Policy Response was: {{ 0 false [] { } }}
fixture_install.go:310: [test TestEndpointAgentServiceMonitoring] Inside fixture cleanup function
fixture_install.go:326: collecting diagnostics; test failed
fixture.go:665: >> running binary with: [/opt/Elastic/Agent/elastic-agent diagnostics -f /opt/buildkite-agent/builds/bk-agent-prod-gcp-1741105630137925843/elastic/elastic-agent/build/diagnostics/TestEndpointAgentServiceMonitoring-2025-03-04T16-34-52Z-diagnostics.zip]
fixture.go:665: >> running binary with: [/opt/Elastic/Agent/elastic-agent uninstall --force]
fixture.go:1033: Dumping running processes in /opt/buildkite-agent/builds/bk-agent-prod-gcp-1741105630137925843/elastic/elastic-agent/build/diagnostics/TestEndpointAgentServiceMonitoring-2025-03-04T16-34-52Z-ProcessDump-cleanup.json
fixture.go:1284: Temporary directory "/tmp/TestEndpointAgentServiceMonitoring33601672" preserved for investigation/debugging
--- FAIL: TestEndpointAgentServiceMonitoring (91.20s)
Failing test case
TestEndpointAgentServiceMonitoring
Error message
Unable to remove package with existing package policy(s) in use by agent(s)
Build
https://buildkite.com/elastic/elastic-agent/builds/18050#019561f7-4cce-4b74-bd65-d885afbd5490
OS
Linux
Stacktrace and notes
=== RUN TestEndpointAgentServiceMonitoring monitoring_endpoint_test.go:64: Enrolling the agent in Fleet tools.go:104: Creating enrollment API key... tools.go:95: Creating enrollment API key... fixture_install.go:199: [test TestEndpointAgentServiceMonitoring] Inside fixture install function fixture_install.go:227: [test TestEndpointAgentServiceMonitoring] Inside fixture installNoPkgManager function fixture.go:290: Extracting artifact elastic-agent-9.0.0-SNAPSHOT-linux-x86_64.tar.gz to /tmp/TestEndpointAgentServiceMonitoring33601672 fixture.go:308: Completed extraction of artifact elastic-agent-9.0.0-SNAPSHOT-linux-x86_64.tar.gz to /tmp/TestEndpointAgentServiceMonitoring33601672 fixture.go:908: Components were not modified from the fetched artifact fixture.go:665: >> running binary with: [/tmp/TestEndpointAgentServiceMonitoring33601672/elastic-agent-9.0.0-SNAPSHOT-linux-x86_64/elastic-agent install --force --non-interactive --url https://7c5f5e0e8f01b9dd08f1f88498fdf04a.fleet.us-west2.gcp.elastic-cloud.com:443 --enrollment-token WWVrQllwVUI0Q0J5MWlMM1pucjQ6UFZGSG5OWlg3dk9GMmJHTmlBdkdvUQ==] tools.go:95: >>> Enroll succeeded. Output: Installing in non-interactive mode. [ ] Copying install files [0s] [ ===] Successfully copied files [2s] [ ===] Installing service [2s] [ =] Installed service [3s] [ =] Starting Service [3s] [ ==] Service Started [3s] Elastic Agent successfully installed, starting enrollment. [ ==] Enrolling Elastic Agent with Fleet [3s] [ ==] Waiting For Enroll... [3s] {"log.level":"info","@timestamp":"2025-03-04T16:33:51.628Z","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.(*enrollCmd).enrollWithBackoff","file.name":"cmd/enroll_cmd.go","file.line":524},"message":"Starting enrollment to URL: https://7c5f5e0e8f01b9dd08f1f88498fdf04a.fleet.us-west2.gcp.elastic-cloud.com:443/","ecs.version":"1.6.0"} {"log.level":"info","@timestamp":"2025-03-04T16:33:53.179Z","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.(*enrollCmd).daemonReloadWithBackoff","file.name":"cmd/enroll_cmd.go","file.line":487},"message":"Restarting agent daemon, attempt 0","ecs.version":"1.6.0"} {"log.level":"info","@timestamp":"2025-03-04T16:33:53.181Z","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.(*enrollCmd).Execute","file.name":"cmd/enroll_cmd.go","file.line":305},"message":"Successfully triggered restart on running Elastic Agent.","ecs.version":"1.6.0"} Successfully enrolled the Elastic Agent. [= ] Enroll Completed [5s] [= ] Done [5s] [= ] Done [5s] Elastic Agent has been successfully installed. monitoring_endpoint_test.go:87: Installing Elastic Defend monitoring_endpoint_test.go:88: Templating endpoint package policy request monitoring_endpoint_test.go:88: POST /api/fleet/package_policies monitoring_endpoint_test.go:88: Error installing fleet package: Unable to remove package with existing package policy(s) in use by agent(s) monitoring_endpoint_test.go:89: Error Trace: /opt/buildkite-agent/builds/bk-agent-prod-gcp-1741105630137925843/elastic/elastic-agent/testing/integration/monitoring_endpoint_test.go:89 /opt/buildkite-agent/.asdf/installs/golang/1.23.6/packages/pkg/mod/github.com/stretchr/testify@v1.10.0/suite/suite.go:157 /opt/buildkite-agent/builds/bk-agent-prod-gcp-1741105630137925843/elastic/elastic-agent/testing/integration/monitoring_endpoint_test.go:56 Error: Received unexpected error: error installing fleet package: Unable to remove package with existing package policy(s) in use by agent(s) Test: TestEndpointAgentServiceMonitoring Messages: Policy Response was: {{ 0 false [] { } }} fixture_install.go:310: [test TestEndpointAgentServiceMonitoring] Inside fixture cleanup function fixture_install.go:326: collecting diagnostics; test failed fixture.go:665: >> running binary with: [/opt/Elastic/Agent/elastic-agent diagnostics -f /opt/buildkite-agent/builds/bk-agent-prod-gcp-1741105630137925843/elastic/elastic-agent/build/diagnostics/TestEndpointAgentServiceMonitoring-2025-03-04T16-34-52Z-diagnostics.zip] fixture.go:665: >> running binary with: [/opt/Elastic/Agent/elastic-agent uninstall --force] fixture.go:1033: Dumping running processes in /opt/buildkite-agent/builds/bk-agent-prod-gcp-1741105630137925843/elastic/elastic-agent/build/diagnostics/TestEndpointAgentServiceMonitoring-2025-03-04T16-34-52Z-ProcessDump-cleanup.json fixture.go:1284: Temporary directory "/tmp/TestEndpointAgentServiceMonitoring33601672" preserved for investigation/debugging --- FAIL: TestEndpointAgentServiceMonitoring (91.20s)