From 4146df1f024c46e1b6fe6eb7a838c49e12d82c9c Mon Sep 17 00:00:00 2001
From: Allen Porter <allen@thebends.org>
Date: Wed, 4 Aug 2021 08:05:35 -0700
Subject: [PATCH] Replace init() with TestMain()

Signed-off-by: Allen Porter <allen@thebends.org>
---
 cmd/flux/main_test.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmd/flux/main_test.go b/cmd/flux/main_test.go
index 815999bb..ee0c676d 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) {
-- 
GitLab