diff --git a/cmd/flux/main_test.go b/cmd/flux/main_test.go
index 815999bbf9041e1ca7e1f17d79a20bcc493a640d..ee0c676d736e294725181434f5029195b706b568 100644
--- a/cmd/flux/main_test.go
+++ b/cmd/flux/main_test.go
@@ -17,9 +17,10 @@ import (
 	fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake"
 )
 
-func init() {
+func TestMain(m *testing.M) {
 	// Ensure tests print consistent timestamps regardless of timezone
 	os.Setenv("TZ", "UTC")
+	os.Exit(m.Run())
 }
 
 func readYamlObjects(objectFile string) ([]client.Object, error) {