diff --git a/Makefile b/Makefile index 53be6a7dd72..25c141970de 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ TAGS := daemon endif ifndef PKGS +# shell does not honor export command above, so we need to explicitly pass GOFLAGS here PKGS := $(shell GOFLAGS=-mod=vendor go list ./... 2>&1 | grep -v 'github.com/portworx/torpedo/tests') endif diff --git a/tests/asg/asg_test.go b/tests/asg/asg_test.go index da41f8f9042..aefeb61d2a3 100644 --- a/tests/asg/asg_test.go +++ b/tests/asg/asg_test.go @@ -3,6 +3,7 @@ package tests import ( "fmt" "math/rand" + "os" "testing" "time" @@ -203,8 +204,10 @@ var _ = AfterSuite(func() { ValidateCleanup() }) -func init() { +func TestMain(m *testing.M) { + // call flag.Parse() here if TestMain uses flags ParseFlags() + os.Exit(m.Run()) } func Scale(count int64) { diff --git a/tests/autopilot/autopilot_test.go b/tests/autopilot/autopilot_test.go index 1837ee3a61e..df426f9bf28 100644 --- a/tests/autopilot/autopilot_test.go +++ b/tests/autopilot/autopilot_test.go @@ -2,6 +2,7 @@ package tests import ( "fmt" + "os" "strings" "testing" "time" @@ -525,6 +526,8 @@ var _ = AfterSuite(func() { ValidateCleanup() }) -func init() { +func TestMain(m *testing.M) { + // call flag.Parse() here if TestMain uses flags ParseFlags() + os.Exit(m.Run()) } diff --git a/tests/basic/basic_test.go b/tests/basic/basic_test.go index 98ec8fe7c4e..46476b3be04 100644 --- a/tests/basic/basic_test.go +++ b/tests/basic/basic_test.go @@ -3,6 +3,7 @@ package tests import ( "fmt" "math/rand" + "os" "testing" "time" @@ -444,6 +445,8 @@ var _ = AfterSuite(func() { ValidateCleanup() }) -func init() { +func TestMain(m *testing.M) { + // call flag.Parse() here if TestMain uses flags ParseFlags() + os.Exit(m.Run()) } diff --git a/tests/drive_failure/drive_failure_test.go b/tests/drive_failure/drive_failure_test.go index eaf57382f5d..871e38e2391 100644 --- a/tests/drive_failure/drive_failure_test.go +++ b/tests/drive_failure/drive_failure_test.go @@ -2,6 +2,7 @@ package tests import ( "fmt" + "os" "testing" "time" @@ -122,6 +123,8 @@ var _ = AfterSuite(func() { ValidateCleanup() }) -func init() { +func TestMain(m *testing.M) { + // call flag.Parse() here if TestMain uses flags ParseFlags() + os.Exit(m.Run()) } diff --git a/tests/node_decommission/node_decommission_test.go b/tests/node_decommission/node_decommission_test.go index 5aac34fbb57..d1f1fe95321 100644 --- a/tests/node_decommission/node_decommission_test.go +++ b/tests/node_decommission/node_decommission_test.go @@ -3,6 +3,7 @@ package tests import ( "fmt" "math/rand" + "os" "testing" "time" @@ -121,6 +122,8 @@ var _ = AfterSuite(func() { ValidateCleanup() }) -func init() { +func TestMain(m *testing.M) { + // call flag.Parse() here if TestMain uses flags ParseFlags() + os.Exit(m.Run()) } diff --git a/tests/reboot/reboot_test.go b/tests/reboot/reboot_test.go index f4a3d1c8637..fa4a7d41dc4 100644 --- a/tests/reboot/reboot_test.go +++ b/tests/reboot/reboot_test.go @@ -2,6 +2,7 @@ package tests import ( "fmt" + "os" "testing" "time" @@ -160,6 +161,8 @@ var _ = AfterSuite(func() { ValidateCleanup() }) -func init() { +func TestMain(m *testing.M) { + // call flag.Parse() here if TestMain uses flags ParseFlags() + os.Exit(m.Run()) } diff --git a/tests/sched/sched_test.go b/tests/sched/sched_test.go index e02889711af..49cc51b759a 100644 --- a/tests/sched/sched_test.go +++ b/tests/sched/sched_test.go @@ -2,6 +2,7 @@ package tests import ( "fmt" + "os" "testing" "time" @@ -83,6 +84,8 @@ var _ = AfterSuite(func() { ValidateCleanup() }) -func init() { +func TestMain(m *testing.M) { + // call flag.Parse() here if TestMain uses flags ParseFlags() + os.Exit(m.Run()) } diff --git a/tests/upgrade/upgrade_test.go b/tests/upgrade/upgrade_test.go index cdb8e497924..33b7e5848f1 100644 --- a/tests/upgrade/upgrade_test.go +++ b/tests/upgrade/upgrade_test.go @@ -2,6 +2,7 @@ package tests import ( "fmt" + "os" "strings" "testing" @@ -116,6 +117,8 @@ var _ = AfterSuite(func() { ValidateCleanup() }) -func init() { +func TestMain(m *testing.M) { + // call flag.Parse() here if TestMain uses flags ParseFlags() + os.Exit(m.Run()) } diff --git a/tests/volume_ops/volume_ops_test.go b/tests/volume_ops/volume_ops_test.go index 71a86e3c15f..15e163323ff 100644 --- a/tests/volume_ops/volume_ops_test.go +++ b/tests/volume_ops/volume_ops_test.go @@ -3,6 +3,7 @@ package tests import ( "fmt" "math" + "os" "testing" . "github.com/onsi/ginkgo" @@ -167,6 +168,8 @@ var _ = AfterSuite(func() { ValidateCleanup() }) -func init() { +func TestMain(m *testing.M) { + // call flag.Parse() here if TestMain uses flags ParseFlags() + os.Exit(m.Run()) }