From e55e687f9855bf1f7694b2a06a000fcaf99cc28c Mon Sep 17 00:00:00 2001 From: Panos Koutsovasilis Date: Thu, 6 Mar 2025 10:20:03 +0200 Subject: [PATCH] [flakiness] Correct group for TestEndpointAgentServiceMonitoring (#7165) * fix: move TestEndpointAgentServiceMonitoring under FleetEndpointSecurity execution group * fix: specify full endpoint path in pgrep and pkill of TestEndpointMetricsAfterRestart (cherry picked from commit 31aac31e6f5aa63932aa37eb1f30cbeab00e22bf) --- testing/integration/monitoring_endpoint_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testing/integration/monitoring_endpoint_test.go b/testing/integration/monitoring_endpoint_test.go index 07c0ea49e88..f71ac983f9f 100644 --- a/testing/integration/monitoring_endpoint_test.go +++ b/testing/integration/monitoring_endpoint_test.go @@ -34,7 +34,7 @@ type EndpointMetricsMonRunner struct { func TestEndpointAgentServiceMonitoring(t *testing.T) { info := define.Require(t, define.Requirements{ - Group: Fleet, + Group: FleetEndpointSecurity, Stack: &define.Stack{}, Local: false, // requires Agent installation Sudo: true, // requires Agent installation @@ -135,18 +135,19 @@ func (runner *EndpointMetricsMonRunner) TestEndpointMetricsAfterRestart() { } // kill endpoint - cmd := exec.Command("pgrep", "-f", "endpoint") + cmd := exec.Command("pgrep", "-f", "/opt/Elastic/Endpoint/elastic-endpoint") pgrep, err := cmd.CombinedOutput() + require.NoError(runner.T(), err) runner.T().Logf("killing pid: %s", string(pgrep)) - cmd = exec.Command("pkill", "--signal", "SIGKILL", "-f", "endpoint") + cmd = exec.Command("pkill", "--signal", "SIGKILL", "-f", "/opt/Elastic/Endpoint/elastic-endpoint") _, err = cmd.CombinedOutput() require.NoError(runner.T(), err) // wait for endpoint to come back up. We use `pgrep` // since the agent health status won't immediately register that the endpoint process itself is gone. require.Eventually(runner.T(), func() bool { - cmd := exec.Command("pgrep", "-f", "endpoint") + cmd := exec.Command("pgrep", "-f", "/opt/Elastic/Endpoint/elastic-endpoint") pgrep, err := cmd.CombinedOutput() runner.T().Logf("found pid: %s", string(pgrep)) if err == nil {