diff --git a/server/pruning_test.go b/server/pruning_test.go index 0d4d0bc6c..41fab48ec 100644 --- a/server/pruning_test.go +++ b/server/pruning_test.go @@ -42,6 +42,7 @@ func TestGetPruningOptionsFromFlags(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(j *testing.T) { + tt := tt viper.Reset() tt.initParams() require.Equal(t, tt.expectedOptions, GetPruningOptionsFromFlags()) diff --git a/server/start_test.go b/server/start_test.go index 169a6fb5a..a9ef4b88e 100644 --- a/server/start_test.go +++ b/server/start_test.go @@ -86,15 +86,19 @@ func TestPruningOptions(t *testing.T) { } for _, tt := range tests { - viper.Reset() - tt.paramInit() + t.Run(tt.name, func(t *testing.T) { + tt := tt - err := startCommand.PreRunE(nil, nil) + viper.Reset() + tt.paramInit() - if tt.returnsErr { - require.EqualError(t, err, tt.expectedErr.Error()) - } else { - require.NoError(t, err) - } + err := startCommand.PreRunE(nil, nil) + + if tt.returnsErr { + require.EqualError(t, err, tt.expectedErr.Error()) + } else { + require.NoError(t, err) + } + }) } }