From 69f48d87a44227167474146f466fcbac53b6299e Mon Sep 17 00:00:00 2001 From: whypro Date: Mon, 16 Sep 2019 14:32:46 +0800 Subject: [PATCH] Move flag parse to main func from init() --- test/e2e/e2e_test.go | 5 +---- test/e2e_node/environment/conformance.go | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 6aa19ab9ab2..cc60cb1373a 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -69,7 +69,7 @@ func handleFlags() { flag.Parse() } -func init() { +func TestMain(m *testing.M) { // Register test flags, then parse flags. handleFlags() @@ -105,9 +105,6 @@ func init() { AssetNames: generated.AssetNames, }) -} - -func TestMain(m *testing.M) { rand.Seed(time.Now().UnixNano()) os.Exit(m.Run()) } diff --git a/test/e2e_node/environment/conformance.go b/test/e2e_node/environment/conformance.go index c4828865c62..377c09dbdc9 100644 --- a/test/e2e_node/environment/conformance.go +++ b/test/e2e_node/environment/conformance.go @@ -45,11 +45,11 @@ func init() { // Set this to false to undo util/logs.go settings it to true. Prevents cadvisor log spam. // Remove this once util/logs.go stops setting the flag to true. flag.Set("logtostderr", "false") - flag.Parse() } // TODO: Should we write an e2e test for this? func main() { + flag.Parse() o := strings.Split(*checkFlag, ",") errs := check(o...) if len(errs) > 0 {