Skip to content

Commit

Permalink
add nvidia-device-plugin test
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr committed Sep 25, 2023
1 parent 091ff2d commit 03384a5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/integration/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestAddons(t *testing.T) {
// so we override that here to let minikube auto-detect appropriate cgroup driver
os.Setenv(constants.MinikubeForceSystemdEnv, "")

args := append([]string{"start", "-p", profile, "--wait=true", "--memory=4000", "--alsologtostderr", "--addons=registry", "--addons=metrics-server", "--addons=volumesnapshots", "--addons=csi-hostpath-driver", "--addons=gcp-auth", "--addons=cloud-spanner", "--addons=inspektor-gadget"}, StartArgs()...)
args := append([]string{"start", "-p", profile, "--wait=true", "--memory=4000", "--alsologtostderr", "--addons=registry", "--addons=metrics-server", "--addons=volumesnapshots", "--addons=csi-hostpath-driver", "--addons=gcp-auth", "--addons=cloud-spanner", "--addons=inspektor-gadget", "--addons=nvidia-device-plugin"}, StartArgs()...)
if !NoneDriver() { // none driver does not support ingress
args = append(args, "--addons=ingress", "--addons=ingress-dns")
}
Expand Down Expand Up @@ -111,6 +111,7 @@ func TestAddons(t *testing.T) {
{"CSI", validateCSIDriverAndSnapshots},
{"Headlamp", validateHeadlampAddon},
{"CloudSpanner", validateCloudSpannerAddon},
{"NvidiaDevicePlugin", validateNvidiaDevicePlugin},
}
for _, tc := range tests {
tc := tc
Expand Down Expand Up @@ -837,3 +838,15 @@ func validateCloudSpannerAddon(ctx context.Context, t *testing.T, profile string
t.Errorf("failed to disable cloud-spanner addon: args %q : %v", rr.Command(), err)
}
}

// validateNvidiaDevicePlugin tests the nvidia-device-plugin addon by ensuring the pod comes up and the addon disables
func validateNvidiaDevicePlugin(ctx context.Context, t *testing.T, profile string) {
defer PostMortemLogs(t, profile)

if _, err := PodWait(ctx, t, profile, "kube-system", "nvidia-device-plugin-ds", Minutes(1)); err != nil {
t.Fatalf("failed waiting for nvidia-device-plugin-ds pod: %v", err)
}
if rr, err := Run(t, exec.CommandContext(ctx, Target(), "addons", "disable", "nvidia-device-plugin", "-p", profile)); err != nil {
t.Errorf("failed to disable nvidia-device-plugin: args %q : %v", rr.Command(), err)
}
}

0 comments on commit 03384a5

Please sign in to comment.