From 992542a083ec00bf8c8276c4407f229e4bbf1fa5 Mon Sep 17 00:00:00 2001 From: James Ryans Date: Fri, 5 Apr 2024 22:57:01 +0700 Subject: [PATCH] Move cmd.Process.Kill() to inside t.CleanUp Signed-off-by: James Ryans --- cmd/jaeger/internal/integration/integration.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/jaeger/internal/integration/integration.go b/cmd/jaeger/internal/integration/integration.go index 3a2938fadc7..74a28e3bd23 100644 --- a/cmd/jaeger/internal/integration/integration.go +++ b/cmd/jaeger/internal/integration/integration.go @@ -27,8 +27,6 @@ const otlpPort = 4317 type E2EStorageIntegration struct { integration.StorageIntegration ConfigFile string - - binaryProcess *os.Process } // e2eInitialize starts the Jaeger-v2 collector with the provided config file, @@ -45,7 +43,9 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T) { Stderr: os.Stderr, } require.NoError(t, cmd.Start()) - s.binaryProcess = cmd.Process + t.Cleanup(func() { + require.NoError(t, cmd.Process.Kill()) + }) spanWriter := createSpanWriter(otlpPort) require.NoError(t, spanWriter.Start()) @@ -59,6 +59,4 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T) { func (s *E2EStorageIntegration) e2eCleanUp(t *testing.T) { require.NoError(t, s.SpanReader.(io.Closer).Close()) require.NoError(t, s.SpanWriter.(io.Closer).Close()) - - s.binaryProcess.Kill() }