From d89548defd09ccb3efbbfeb81530ea38aea40029 Mon Sep 17 00:00:00 2001 From: Matthias Kutz Date: Sat, 8 Jan 2022 23:25:47 +0100 Subject: [PATCH] #10 Reset flags for testing --- pkg/conf/conf_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/conf/conf_test.go b/pkg/conf/conf_test.go index 0207d4d..1a2960c 100644 --- a/pkg/conf/conf_test.go +++ b/pkg/conf/conf_test.go @@ -5,9 +5,11 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/namsral/flag" ) func TestReadEnvs(t *testing.T) { + flag.ResetForTesting(nil) assert := assert.New(t) os.Setenv(EnvZoneName, "example.com") @@ -28,6 +30,7 @@ func TestReadEnvs(t *testing.T) { } func TestReadOptionalEnvs(t *testing.T) { + flag.ResetForTesting(nil) assert := assert.New(t) os.Setenv(EnvZoneName, "example.com") @@ -50,6 +53,7 @@ func TestReadOptionalEnvs(t *testing.T) { } func TestAllMissingArgs(t *testing.T) { + flag.ResetForTesting(nil) assert := assert.New(t) // No args @@ -58,6 +62,7 @@ func TestAllMissingArgs(t *testing.T) { } func TestFewMissingArgs(t *testing.T) { + flag.ResetForTesting(nil) assert := assert.New(t) // Missing mandatory args