Merge pull request #16109 from spowelljr/fixUnitTest
tests: Fix unit test failing if docker not runningpull/16119/head
commit
2cd5e023e9
|
@ -44,7 +44,7 @@ var (
|
|||
)
|
||||
|
||||
// CachedDaemonInfo will run and return a docker/podman info only once per minikube run time. to avoid performance
|
||||
func CachedDaemonInfo(ociBin string) (SysInfo, error) {
|
||||
var CachedDaemonInfo = func(ociBin string) (SysInfo, error) {
|
||||
if cachedSysInfo == nil {
|
||||
si, err := DaemonInfo(ociBin)
|
||||
cachedSysInfo = &si
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/blang/semver/v4"
|
||||
"k8s.io/minikube/pkg/drivers/kic/oci"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/registry"
|
||||
)
|
||||
|
@ -185,6 +186,7 @@ func TestStatus(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
dockerVersionOrState = func() (string, registry.State) { return tt.input, registry.State{} }
|
||||
oci.CachedDaemonInfo = func(string) (oci.SysInfo, error) { return oci.SysInfo{}, nil }
|
||||
state := status()
|
||||
err := state.Error
|
||||
if (err == nil && tt.shouldReturnError) || (err != nil && !tt.shouldReturnError) {
|
||||
|
|
Loading…
Reference in New Issue