Skip to content

Commit

Permalink
fix: specify full endpoint path in pgrep and pkill of TestEndpointMet…
Browse files Browse the repository at this point in the history
…ricsAfterRestart
  • Loading branch information
pkoutsovasilis committed Mar 4, 2025
1 parent 8f13892 commit 5cd2f72
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions testing/integration/monitoring_endpoint_test.go
Original file line number Diff line number Diff line change
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 imidately 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 5cd2f72

Please sign in to comment.