diff --git a/cmd/frostfs-cli/internal/key/key_test.go b/cmd/frostfs-cli/internal/key/key_test.go index e3127a3fe..37e4fd4ee 100644 --- a/cmd/frostfs-cli/internal/key/key_test.go +++ b/cmd/frostfs-cli/internal/key/key_test.go @@ -24,6 +24,8 @@ var testCmd = &cobra.Command{ } func Test_getOrGenerate(t *testing.T) { + t.Cleanup(viper.Reset) + dir := t.TempDir() wallPath := filepath.Join(dir, "wallet.json") diff --git a/cmd/frostfs-node/config/test/config.go b/cmd/frostfs-node/config/test/config.go index 28ec65291..a93d7e648 100644 --- a/cmd/frostfs-node/config/test/config.go +++ b/cmd/frostfs-node/config/test/config.go @@ -40,6 +40,15 @@ func ForEachFileType(pref string, f func(*config.Config)) { // ForEnvFileType creates config from `.env` file. func ForEnvFileType(t testing.TB, pref string, f func(*config.Config)) { + envs := os.Environ() + t.Cleanup(func() { + os.Clearenv() + for _, env := range envs { + keyValue := strings.Split(env, "=") + os.Setenv(keyValue[0], keyValue[1]) + } + }) + f(fromEnvFile(t, pref+".env")) }