From 5e3f26f25bc572a477f73242eadd3a6c332ffdda Mon Sep 17 00:00:00 2001 From: Ukri Niemimuukko Date: Tue, 11 Jan 2022 17:56:42 +0200 Subject: [PATCH] add device check to gpu e2e test and e2e-gpu makefile target Signed-off-by: Ukri Niemimuukko --- Makefile | 3 +++ test/e2e/gpu/gpu.go | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 21c3ffad..9435a196 100644 --- a/Makefile +++ b/Makefile @@ -141,6 +141,9 @@ e2e-qat: e2e-sgx: @$(GO) test -v ./test/e2e/... -ginkgo.v -ginkgo.progress -ginkgo.focus "SGX" -delete-namespace-on-failure=false +e2e-gpu: + @$(GO) test -v ./test/e2e/... -ginkgo.v -ginkgo.progress -ginkgo.focus "GPU" -delete-namespace-on-failure=false + pre-pull: ifeq ($(TAG),devel) @$(BUILDER) pull golang:1.17-bullseye diff --git a/test/e2e/gpu/gpu.go b/test/e2e/gpu/gpu.go index 0d879b73..918c43b3 100644 --- a/test/e2e/gpu/gpu.go +++ b/test/e2e/gpu/gpu.go @@ -17,6 +17,7 @@ package gpu import ( "context" "path/filepath" + "strings" "time" "github.com/intel/intel-device-plugins-for-kubernetes/test/e2e/utils" @@ -33,6 +34,7 @@ import ( const ( kustomizationYaml = "deployments/gpu_plugin/kustomization.yaml" + containerName = "testcontainer" ) func init() { @@ -70,8 +72,8 @@ func describe() { Spec: v1.PodSpec{ Containers: []v1.Container{ { - Args: []string{"-c", "echo hello world"}, - Name: "testcontainer", + Args: []string{"-c", "ls /dev/dri"}, + Name: containerName, Image: imageutils.GetE2EImage(imageutils.BusyBox), Command: []string{"/bin/sh"}, Resources: v1.ResourceRequirements{ @@ -88,5 +90,18 @@ func describe() { ginkgo.By("waiting the pod to finnish successfully") f.PodClient().WaitForFinish(pod.ObjectMeta.Name, 60*time.Second) + + ginkgo.By("checking log output") + log, err := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName) + + if err != nil { + framework.Failf("unable to get log from pod: %v", err) + } + + if !strings.Contains(log, "card") || !strings.Contains(log, "renderD") { + framework.Failf("device mounts not found from log") + } + + framework.Logf("found card and renderD from the log") }) }