Merge pull request #845 from uniemimu/e2egpu

add device check to gpu e2e test and e2e-gpu makefile target
This commit is contained in:
Mikko Ylinen 2022-01-12 15:51:43 +02:00 committed by GitHub
commit bc66bc4fb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -141,6 +141,9 @@ e2e-qat:
e2e-sgx: e2e-sgx:
@$(GO) test -v ./test/e2e/... -ginkgo.v -ginkgo.progress -ginkgo.focus "SGX" -delete-namespace-on-failure=false @$(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: pre-pull:
ifeq ($(TAG),devel) ifeq ($(TAG),devel)
@$(BUILDER) pull golang:1.17-bullseye @$(BUILDER) pull golang:1.17-bullseye

View File

@ -17,6 +17,7 @@ package gpu
import ( import (
"context" "context"
"path/filepath" "path/filepath"
"strings"
"time" "time"
"github.com/intel/intel-device-plugins-for-kubernetes/test/e2e/utils" "github.com/intel/intel-device-plugins-for-kubernetes/test/e2e/utils"
@ -33,6 +34,7 @@ import (
const ( const (
kustomizationYaml = "deployments/gpu_plugin/kustomization.yaml" kustomizationYaml = "deployments/gpu_plugin/kustomization.yaml"
containerName = "testcontainer"
) )
func init() { func init() {
@ -70,8 +72,8 @@ func describe() {
Spec: v1.PodSpec{ Spec: v1.PodSpec{
Containers: []v1.Container{ Containers: []v1.Container{
{ {
Args: []string{"-c", "echo hello world"}, Args: []string{"-c", "ls /dev/dri"},
Name: "testcontainer", Name: containerName,
Image: imageutils.GetE2EImage(imageutils.BusyBox), Image: imageutils.GetE2EImage(imageutils.BusyBox),
Command: []string{"/bin/sh"}, Command: []string{"/bin/sh"},
Resources: v1.ResourceRequirements{ Resources: v1.ResourceRequirements{
@ -88,5 +90,18 @@ func describe() {
ginkgo.By("waiting the pod to finnish successfully") ginkgo.By("waiting the pod to finnish successfully")
f.PodClient().WaitForFinish(pod.ObjectMeta.Name, 60*time.Second) 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")
}) })
} }