Skip to content

Commit

Permalink
[flakiness] Correct group for TestEndpointAgentServiceMonitoring (#7165
Browse files Browse the repository at this point in the history
…) (#7231)

* fix: move TestEndpointAgentServiceMonitoring under FleetEndpointSecurity execution group

* fix: specify full endpoint path in pgrep and pkill of TestEndpointMetricsAfterRestart

(cherry picked from commit 31aac31)

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
  • Loading branch information
mergify[bot] and pkoutsovasilis authored Mar 6, 2025
1 parent 40260c6 commit 85c9a6c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions testing/integration/monitoring_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 85c9a6c

Please sign in to comment.