Skip to content

Commit 410c40c

Browse files
authored
Ensure we wait the Elastic-Agent process to finish (#4695)
1 parent 52be253 commit 410c40c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

testing/integration/container_cmd_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ func TestContainerCMD(t *testing.T) {
9292
if err := cmd.Process.Kill(); err != nil {
9393
t.Fatalf("could not kill Elastic-Agent process: %s", err)
9494
}
95+
96+
// Kill does not wait for the process to finish, so we wait here
97+
state, err := cmd.Process.Wait()
98+
if err != nil {
99+
t.Errorf("Elastic-Agent exited with error after kill signal: %s", err)
100+
t.Errorf("Elastic-Agent exited with status %d", state.ExitCode())
101+
out, err := cmd.CombinedOutput()
102+
if err == nil {
103+
t.Log(string(out))
104+
}
105+
}
106+
95107
return
96108
}
97109
t.Log(">> cleaning up: no process to kill")

0 commit comments

Comments
 (0)