Merge pull request #106584 from jonyhy96/fix-test-flake

[cloud-provider] fix test failed because of flag redefined
This commit is contained in:
Kubernetes Prow Robot 2021-12-07 18:26:17 -08:00 committed by GitHub
commit 32a244552e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -206,6 +206,10 @@ func configFromEnvOrSim() (VSphereConfig, func()) {
return configFromSim()
}
func init() {
klog.InitFlags(nil)
}
func TestSecretUpdated(t *testing.T) {
datacenter := "0.0.0.0"
secretName := "vccreds"
@ -227,9 +231,7 @@ func TestSecretUpdated(t *testing.T) {
if err != nil {
t.Fatalf("Should succeed when a valid config is provided: %s", err)
}
klog.Flush()
klog.InitFlags(nil)
flag.Set("logtostderr", "false")
flag.Set("alsologtostderr", "false")
flag.Set("v", "9")