linux: fix kubelet start unit test

This commit is contained in:
Paco Xu 2022-11-04 21:34:32 +08:00
parent 89e4836dde
commit 1b71dc77f2
2 changed files with 8 additions and 2 deletions

View File

@ -46,6 +46,12 @@ var _ Watcher = &realWatcher{}
// NewWatcher creates and initializes a OOMWatcher backed by Cadvisor as
// the oom streamer.
func NewWatcher(recorder record.EventRecorder) (Watcher, error) {
// for test purpose
_, ok := recorder.(*record.FakeRecorder)
if ok {
return nil, nil
}
oomStreamer, err := oomparser.New()
if err != nil {
return nil, err

View File

@ -261,7 +261,7 @@ func (kvh *kubeletVolumeHost) GetSecretFunc() func(namespace, name string) (*v1.
return kvh.secretManager.GetSecret
}
return func(namespace, name string) (*v1.Secret, error) {
return nil, fmt.Errorf("not supported")
return nil, fmt.Errorf("not supported due to running kubelet in standalone mode")
}
}
@ -270,7 +270,7 @@ func (kvh *kubeletVolumeHost) GetConfigMapFunc() func(namespace, name string) (*
return kvh.configMapManager.GetConfigMap
}
return func(namespace, name string) (*v1.ConfigMap, error) {
return nil, fmt.Errorf("not supported")
return nil, fmt.Errorf("not supported due to running kubelet in standalone mode")
}
}