elastic / elastic/elastic-agent

[Flaky Test]: TestInstallAndCLIUninstallWithEndpointSecurity/unprotected – Endpoint component or units are not healthy.

Open
#12,486 8 comments 0 reactions 0 assignees View on GitHub
flaky-test Team:Elastic-Agent
Dominant language
Go
Stars
275
Forks
264
Avg merge
1d 20h
Merged PRs (30d)
298

Description

### Failing test case

TestInstallAndCLIUninstallWithEndpointSecurity/unprotected

### Error message

Endpoint component or units are not healthy

### Build

https://buildkite.com/elastic/elastic-agent/builds/33977/steps/table?jid=019c0736-5c23-4ae8-b18a-9f2534450044

### OS

Linux

### Stacktrace and notes

According the state in diagnostics, all the components are healthy, but the agent is degraded.
According to the state logged by the test, endpoint is in a degraded state, but the message indicates success:

```json
{
"Info": {
"ID": "78026c24-eb9c-4b27-93e3-c28bf9efed86",
"Version": "9.4.0",
"Commit": "8bc5dcd09c449fe416911b9e36a1fbeb20f1b29b",
"BuildTime": "2026-01-29T01:02:43Z",
"Snapshot": true,
"PID": 62650,
"Unprivileged": false,
"IsManaged": true
},
"State": "DEGRADED",
"Message": "1 or more components/units in a degraded state",
"Components": [
{
"ID": "endpoint",
"Name": "endpoint",
"State": "HEALTHY",
"Message": "Healthy: communicating with endpoint service",
"Units": [
{
"UnitID": "endpoint-4e73d875-bcc6-4b79-8342-906e26eda8df",
"UnitType": "INPUT",
"State": "DEGRADED",
"Message": "Applied policy 'Defend-4e73d875-bcc6-4b79-8342-906e26eda8df' (Defend policy rev. 1. Agent policy rev. 2.)",
"Payload": {
"error": {
"code": 0,
"message": "Success"
}
}
},
{
"UnitID": "endpoint",
"UnitType": "OUTPUT",
"State": "DEGRADED",
"Message": "Applied policy 'Defend-4e73d875-bcc6-4b79-8342-906e26eda8df' (Defend policy rev. 1. Agent policy rev. 2.)",
"Payload": {
"error": {
"code": 0,
"message": "Success"
}
}
}
],
"VersionInfo": {
"Name": "Endpoint",
"Meta": {}
}
},
{
"ID": "filestream-monitoring",
"Name": "filestream",
"State": "HEALTHY",
"Message": "Healthy",
"Units": [
{
"UnitID": "filestream-monitoring-filestream-monitoring-agent",
"UnitType": "INPUT",
"State": "HEALTHY",
"Message": "Healthy",
"Payload": {
"streams": {
"filestream-monitoring-agent": {
"error": "",
"status": "HEALTHY"
},
"filestream-monitoring-endpoint": {
"error": "",
"status": "HEALTHY"
}
}
}
},
{
"UnitID": "filestream-monitoring",
"UnitType": "OUTPUT",
"State": "HEALTHY",
"Message": "Healthy",
"Payload": {}
}
],
"VersionInfo": {
"Name": "beats-receiver",
"Meta": {
"build_time": "2026-01-29 01:02:43 +0000 UTC",
"commit": "8bc5dcd09c449fe416911b9e36a1fbeb20f1b29b"
}
}
},
{
"ID": "beat/metrics-monitoring",
"Name": "beat/metrics",
"State": "HEALTHY",
"Message": "Healthy",
"Units": [
{
"UnitID": "beat/metrics-monitoring-metrics-monitoring-beats",
"UnitType": "INPUT",
"State": "HEALTHY",
"Message": "",
"Payload": {
"streams": {
"metrics-monitoring-filebeat": {
"error": "",
"status": "HEALTHY"
},
"metrics-monitoring-metricbeat": {
"error": "",
"status": "HEALTHY"
}
}
}
},
{
"UnitID": "beat/metrics-monitoring",
"UnitType": "OUTPUT",
"State": "HEALTHY",
"Message": "Healthy",
"Payload": {}
}
],
"VersionInfo": {
"Name": "beats-receiver",
"Meta": {
"build_time": "2026-01-29 01:02:43 +0000 UTC",
"commit": "8bc5dcd09c449fe416911b9e36a1fbeb20f1b29b"
}
}
},
{
"ID": "http/metrics-monitoring",
"Name": "http/metrics",
"State": "HEALTHY",
"Message": "Healthy",
"Units": [
{
"UnitID": "http/metrics-monitoring-metrics-monitoring-agent",
"UnitType": "INPUT",
"State": "HEALTHY",
"Message": "Healthy",
"Payload": {
"streams": {
"metrics-monitoring-agent": {
"error": "",
"status": "HEALTHY"
},
"metrics-monitoring-edot-collector": {
"error": "",
"status": "HEALTHY"
},
"metrics-monitoring-filebeat-1": {
"error": "",
"status": "HEALTHY"
}
}
}
},
{
"UnitID": "http/metrics-monitoring",
"UnitType": "OUTPUT",
"State": "HEALTHY",
"Message": "Healthy",
"Payload": {}
}
],
"VersionInfo": {
"Name": "beats-receiver",
"Meta": {
"build_time": "2026-01-29 01:02:43 +0000 UTC",
"commit": "8bc5dcd09c449fe416911b9e36a1fbeb20f1b29b"
}
}
},
{
"ID": "system/metrics-monitoring",
"Name": "system/metrics",
"State": "HEALTHY",
"Message": "Healthy",
"Units": [
{
"UnitID": "system/metrics-monitoring-metrics-monitoring-endpoint_security",
"UnitType": "INPUT",
"State": "HEALTHY",
"Message": "Healthy",
"Payload": {
"streams": {
"metrics-monitoring-endpoint_security": {
"error": "",
"status": "HEALTHY"
}
}
}
},
{
"UnitID": "system/metrics-monitoring",
"UnitType": "OUTPUT",
"State": "HEALTHY",
"Message": "Healthy",
"Payload": {}
}
],
"VersionInfo": {
"Name": "beats-receiver",
"Meta": {
"build_time": "2026-01-29 01:02:43 +0000 UTC",
"commit": "8bc5dcd09c449fe416911b9e36a1fbeb20f1b29b"
}
}
}
],
"FleetState": "HEALTHY",
"FleetMessage": "Connected",
"UpgradeDetails": null,
"Collector": ""
}

```

Endpoint logs say that it can't apply the policy, but don't go into any detail:

```
{"@timestamp":"2026-01-29T01:20:50.519024458Z","agent":{"id":"78026c24-eb9c-4b27-93e3-c28bf9efed86","type":"endpoint"},"ecs":{"version":"8.10.0"},"log":{"level":"error","origin":{"file":{"line":3323,"name":"PolicyConfig.cpp"}}},"message":"PolicyConfig.cpp:3323 Initial configuration application failed","process":{"pid":62931,"thread":{"id":62990}}}
{"@timestamp":"2026-01-29T01:20:50.519203408Z","agent":{"id":"78026c24-eb9c-4b27-93e3-c28bf9efed86","type":"endpoint"},"ecs":{"version":"8.10.0"},"log":{"level":"info","origin":{"file":{"line":178,"name":"Metadata.cpp"}}},"message":"Metadata.cpp:178 Sending off-schedule metadata message","process":{"pid":62931,"thread":{"id":62990}}}
{"@timestamp":"2026-01-29T01:20:50.51932214Z","agent":{"id":"78026c24-eb9c-4b27-93e3-c28bf9efed86","type":"endpoint"},"ecs":{"version":"8.10.0"},"log":{"level":"error","origin":{"file":{"line":225,"name":"AgentContext.cpp"}}},"message":"AgentContext.cpp:225 Failed to apply new policy from Agent.","process":{"pid":62931,"thread":{"id":62990}}}
{"@timestamp":"2026-01-29T01:20:50.519415786Z","agent":{"id":"78026c24-eb9c-4b27-93e3-c28bf9efed86","type":"endpoint"},"ecs":{"version":"8.10.0"},"log":{"level":"warning","origin":{"file":{"line":465,"name":"AgentContext.cpp"}}},"message":"AgentContext.cpp:465 Endpoint is setting status to DEGRADED, reason: Policy Application Status","process":{"pid":62931,"thread":{"id":62990}}}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.