Skip to content

Commit

Permalink
Fix TestEnable unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr committed Nov 29, 2023
1 parent 1893a33 commit cee02a2
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions pkg/minikube/cruntime/cruntime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ func TestVersion(t *testing.T) {
// defaultServices reflects the default boot state for the minikube VM
var defaultServices = map[string]serviceState{
"docker": SvcRunning,
"docker.socket": SvcRunning,
"crio": SvcExited,
"crio-shutdown": SvcExited,
"containerd": SvcExited,
Expand All @@ -624,6 +625,7 @@ var defaultServices = map[string]serviceState{
// allServices reflects the state of all actual services running at once
var allServices = map[string]serviceState{
"docker": SvcRunning,
"docker.socket": SvcRunning,
"crio": SvcRunning,
"crio-shutdown": SvcExited,
"containerd": SvcRunning,
Expand Down Expand Up @@ -662,41 +664,46 @@ func TestDisable(t *testing.T) {

func TestEnable(t *testing.T) {
var tests = []struct {
runtime string
services map[string]serviceState
want map[string]serviceState
description string
runtime string
services map[string]serviceState
want map[string]serviceState
}{
{"docker", defaultServices,
{"DockerDefaultServices", "docker", defaultServices,
map[string]serviceState{
"docker": SvcRestarted,
"docker.socket": SvcRunning,
"containerd": SvcExited,
"crio": SvcExited,
"crio-shutdown": SvcExited,
}},
{"docker", allServices,
{"DockerAllServices", "docker", allServices,
map[string]serviceState{
"docker": SvcRestarted,
"docker.socket": SvcRunning,
"containerd": SvcExited,
"crio": SvcExited,
"crio-shutdown": SvcExited,
}},
{"containerd", defaultServices,
{"ContainerdDefaultServices", "containerd", defaultServices,
map[string]serviceState{
"docker": SvcExited,
"docker.socket": SvcExited,
"containerd": SvcRestarted,
"crio": SvcExited,
"crio-shutdown": SvcExited,
}},
{"crio", defaultServices,
{"CrioServices", "crio", defaultServices,
map[string]serviceState{
"docker": SvcExited,
"docker.socket": SvcExited,
"containerd": SvcExited,
"crio": SvcRestarted,
"crio-shutdown": SvcExited,
}},
}
for _, tc := range tests {
t.Run(tc.runtime, func(t *testing.T) {
t.Run(tc.description, func(t *testing.T) {
runner := NewFakeRunner(t)
for k, v := range tc.services {
runner.services[k] = v
Expand Down

0 comments on commit cee02a2

Please sign in to comment.