Skip to content

Commit

Permalink
fix possible nil reference in test
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr committed Oct 4, 2023
1 parent 4b38cbb commit 04a3af2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/minikube/cmd/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,13 +870,17 @@ func TestValidateEnableNvidiaGPUs(t *testing.T) {
{false, "kvm", "containerd", ""},
{true, "docker", "docker", ""},
{true, "docker", "", ""},
{true, "kvm", "docker", "The nvidia-docker container-runtime can only be run with the docker driver"},
{true, "docker", "containerd", "The nvidia-docker container-runtime can only be run with the docker driver"},
{true, "kvm", "docker", "The enable-nvidia-gpus flag can only be run with the docker driver and docker container-runtime"},
{true, "docker", "containerd", "The enable-nvidia-gpus flag can only be run with the docker driver and docker container-runtime"},
}

for _, tc := range tests {
gotError := ""
got := validateEnableNvidiaGPUs(tc.enableNvidiaGPUs, tc.drvName, tc.runtime)
if got.Error() != tc.errorMsg {
if got != nil {
gotError = got.Error()
}
if gotError != tc.errorMsg {
t.Errorf("validateEnableNvidiaGPUs(%t, %s, %s) = %q; want = %q", tc.enableNvidiaGPUs, tc.drvName, tc.runtime, got, tc.errorMsg)
}
}
Expand Down

0 comments on commit 04a3af2

Please sign in to comment.