mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-25 18:29:11 +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. Kubernetes-commit: ac5ce5cbce7ddb6ffeff755d1cf670afadb8e1fb
This commit is contained in:
parent
5a01920212
commit
3ffcfabea2
@ -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