diff --git a/internal/commands/root_test.go b/internal/commands/root_test.go index 654594c5b..149cc4ba8 100644 --- a/internal/commands/root_test.go +++ b/internal/commands/root_test.go @@ -160,6 +160,7 @@ func TestCreateCommand_WithInvalidFlag_ShouldReturnExitCode1(t *testing.T) { func executeTestCommand(cmd *cobra.Command, args ...string) error { fmt.Println("Executing command with args ", args) + defer viper.Reset() cmd.SetArgs(args) cmd.SilenceUsage = true return cmd.Execute() diff --git a/test/integration/configuration_test.go b/test/integration/configuration_test.go index d38c91faa..e1e3398da 100644 --- a/test/integration/configuration_test.go +++ b/test/integration/configuration_test.go @@ -73,6 +73,9 @@ func TestSetConfigProperty_EnvVarConfigFilePath(t *testing.T) { err, _ = executeCommand(t, "configure", "set", "--prop-name", "cx_client_id", "--prop-value", "example_client_id") assert.NilError(t, err) + defer func() { + executeCommand(t, "configure", "set", "--prop-name", "cx_client_id", "--prop-value", "") + }() } func TestLoadConfiguration_ConfigFilePathFlag(t *testing.T) { @@ -100,6 +103,9 @@ func TestSetConfigProperty_ConfigFilePathFlag(t *testing.T) { err, _ = executeCommand(t, "configure", "set", "--prop-name", "cx_client_id", "--prop-value", "example_client_id", "--config-file-path", filePath) assert.NilError(t, err) + defer func() { + executeCommand(t, "configure", "set", "--prop-name", "cx_client_id", "--prop-value", "") + }() } func TestLoadConfiguration_ConfigFilePathFlagFileWithoutPermission(t *testing.T) {