diff --git a/common/grpc/logconnections/logconnections_test.go b/common/grpc/logconnections/logconnections_test.go index b539b1d92..fe8fe85a4 100644 --- a/common/grpc/logconnections/logconnections_test.go +++ b/common/grpc/logconnections/logconnections_test.go @@ -4,7 +4,6 @@ import ( "context" "errors" "flag" - "os" "testing" "github.com/canonical/ubuntu-pro-for-wsl/common/grpc/logconnections" @@ -109,5 +108,5 @@ func TestMain(m *testing.M) { logrus.StandardLogger().SetLevel(logrus.DebugLevel) } - os.Exit(m.Run()) + m.Run() } diff --git a/end-to-end/main_test.go b/end-to-end/main_test.go index e4413431b..5757c50fe 100644 --- a/end-to-end/main_test.go +++ b/end-to-end/main_test.go @@ -101,7 +101,7 @@ func TestMain(m *testing.M) { defer cleanup() testImagePath = path - exitCode := m.Run() + m.Run() if err := cleanupRegistry(); err != nil { log.Printf("Cleanup: registry: %v\n", err) @@ -111,8 +111,6 @@ func TestMain(m *testing.M) { if out, err := cmd.CombinedOutput(); err != nil { log.Printf("Cleanup: could not remove Appx: %v: %s", err, out) } - - os.Exit(exitCode) } func usePrebuiltProject(buildPath string) (err error) { diff --git a/storeapi/go-wrapper/microsoftstore/store_test.go b/storeapi/go-wrapper/microsoftstore/store_test.go index 12f862de4..9112fa0bf 100644 --- a/storeapi/go-wrapper/microsoftstore/store_test.go +++ b/storeapi/go-wrapper/microsoftstore/store_test.go @@ -33,8 +33,7 @@ func TestMain(m *testing.M) { } } - exit := m.Run() - defer os.Exit(exit) + m.Run() } func TestGenerateUserJWT(t *testing.T) { diff --git a/windows-agent/internal/distros/distro/distro_test.go b/windows-agent/internal/distros/distro/distro_test.go index 9d42a7d8f..3acc04051 100644 --- a/windows-agent/internal/distros/distro/distro_test.go +++ b/windows-agent/internal/distros/distro/distro_test.go @@ -23,8 +23,7 @@ import ( func TestMain(m *testing.M) { log.SetLevel(log.DebugLevel) - exit := m.Run() - defer os.Exit(exit) + m.Run() } // globalStartupMu protects against multiple distros starting at the same time. diff --git a/windows-agent/internal/distros/worker/worker_test.go b/windows-agent/internal/distros/worker/worker_test.go index c30615879..21c2aaea8 100644 --- a/windows-agent/internal/distros/worker/worker_test.go +++ b/windows-agent/internal/distros/worker/worker_test.go @@ -30,8 +30,7 @@ func init() { func TestMain(m *testing.M) { log.SetLevel(log.DebugLevel) - exit := m.Run() - defer os.Exit(exit) + m.Run() } func TestNew(t *testing.T) { diff --git a/windows-agent/internal/proservices/landscape/landscape_test.go b/windows-agent/internal/proservices/landscape/landscape_test.go index 62bbe81e2..4b847170e 100644 --- a/windows-agent/internal/proservices/landscape/landscape_test.go +++ b/windows-agent/internal/proservices/landscape/landscape_test.go @@ -40,8 +40,7 @@ import ( func TestMain(m *testing.M) { log.SetLevel(log.DebugLevel) - exit := m.Run() - defer os.Exit(exit) + m.Run() } const defaultLandscapeConfig = ` diff --git a/windows-agent/internal/proservices/proservices_test.go b/windows-agent/internal/proservices/proservices_test.go index b00d877cf..99462f17b 100644 --- a/windows-agent/internal/proservices/proservices_test.go +++ b/windows-agent/internal/proservices/proservices_test.go @@ -26,8 +26,7 @@ import ( func TestMain(m *testing.M) { log.SetLevel(log.DebugLevel) - exit := m.Run() - defer os.Exit(exit) + m.Run() } func TestNew(t *testing.T) { diff --git a/windows-agent/internal/proservices/wslinstance/wslinstance_test.go b/windows-agent/internal/proservices/wslinstance/wslinstance_test.go index 48afbb41e..3e69519de 100644 --- a/windows-agent/internal/proservices/wslinstance/wslinstance_test.go +++ b/windows-agent/internal/proservices/wslinstance/wslinstance_test.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "net" - "os" "sync" "sync/atomic" "testing" @@ -30,8 +29,7 @@ func TestMain(m *testing.M) { task.Register[testTask]() - exit := m.Run() - defer os.Exit(exit) + m.Run() } func TestServe(t *testing.T) { diff --git a/wsl-pro-service/cmd/wsl-pro-service/service/service_test.go b/wsl-pro-service/cmd/wsl-pro-service/service/service_test.go index 4840c4e24..6bd38c49c 100644 --- a/wsl-pro-service/cmd/wsl-pro-service/service/service_test.go +++ b/wsl-pro-service/cmd/wsl-pro-service/service/service_test.go @@ -22,7 +22,7 @@ import ( func TestMain(m *testing.M) { log.SetLevel(log.DebugLevel) - os.Exit(m.Run()) + m.Run() } func TestHelp(t *testing.T) { diff --git a/wsl-pro-service/internal/daemon/daemon_test.go b/wsl-pro-service/internal/daemon/daemon_test.go index 668988e47..7c7c2bf75 100644 --- a/wsl-pro-service/internal/daemon/daemon_test.go +++ b/wsl-pro-service/internal/daemon/daemon_test.go @@ -21,7 +21,7 @@ import ( func TestMain(m *testing.M) { log.SetLevel(log.DebugLevel) - os.Exit(m.Run()) + m.Run() } func TestNew(t *testing.T) {