fix: klog flag redefined

Signed-off-by: haoyun <yun.hao@daocloud.io>
This commit is contained in:
haoyun 2021-11-24 10:03:40 +08:00
parent 991bb65ecc
commit eb673cec64

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")