mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 19:23:40 +00:00
Replace os.Setenv with testing.T.Setenv in tests
T.Setenv ensures that the environment is returned to its prior state when the test ends. It also panics when called from a parallel test to prevent racy test interdependencies.
This commit is contained in:
parent
c07c739f04
commit
ac5ce5cbce
@ -149,7 +149,7 @@ func TestToleratingMissingFiles(t *testing.T) {
|
||||
|
||||
func TestWarningMissingFiles(t *testing.T) {
|
||||
envVarValue := "bogus"
|
||||
os.Setenv(RecommendedConfigPathEnvVar, envVarValue)
|
||||
t.Setenv(RecommendedConfigPathEnvVar, envVarValue)
|
||||
loadingRules := NewDefaultClientConfigLoadingRules()
|
||||
|
||||
buffer := &bytes.Buffer{}
|
||||
@ -174,7 +174,7 @@ func TestWarningMissingFiles(t *testing.T) {
|
||||
|
||||
func TestNoWarningMissingFiles(t *testing.T) {
|
||||
envVarValue := "bogus"
|
||||
os.Setenv(RecommendedConfigPathEnvVar, envVarValue)
|
||||
t.Setenv(RecommendedConfigPathEnvVar, envVarValue)
|
||||
loadingRules := NewDefaultClientConfigLoadingRules()
|
||||
|
||||
buffer := &bytes.Buffer{}
|
||||
|
Loading…
Reference in New Issue
Block a user