@@ -35,8 +35,10 @@ import (
3535)
3636
3737const (
38- kustomizationYaml = "deployments/gpu_plugin/kustomization.yaml"
39- containerName = "testcontainer"
38+ kustomizationYaml = "deployments/gpu_plugin/kustomization.yaml"
39+ containerName = "testcontainer"
40+ tfKustomizationYaml = "demo/intel-gpu-tensorflow/kustomization.yaml"
41+ tfPodName = "training-pod"
4042)
4143
4244func init () {
@@ -113,4 +115,48 @@ func describe() {
113115
114116 framework .Logf ("found card and renderD from the log" )
115117 })
118+
119+ ginkgo .It ("run some tensorflow code on GPU" , func () {
120+ ginkgo .By ("deploying GPU plugin" )
121+ e2ekubectl .RunKubectlOrDie (f .Namespace .Name , "apply" , "-k" , filepath .Dir (kustomizationPath ))
122+
123+ ginkgo .By ("waiting for GPU plugin's availability" )
124+ _ , err := e2epod .WaitForPodsWithLabelRunningReady (f .ClientSet , f .Namespace .Name ,
125+ labels.Set {"app" : "intel-gpu-plugin" }.AsSelector (), 1 /* one replica */ , 100 * time .Second )
126+ if err != nil {
127+ e2edebug .DumpAllNamespaceInfo (f .ClientSet , f .Namespace .Name )
128+ e2ekubectl .LogFailedContainers (f .ClientSet , f .Namespace .Name , framework .Logf )
129+ framework .Failf ("unable to wait for all pods to be running and ready: %v" , err )
130+ }
131+
132+ ginkgo .By ("checking if the resource is allocatable" )
133+ if err = utils .WaitForNodesWithResource (f .ClientSet , "gpu.intel.com/i915" , 30 * time .Second ); err != nil {
134+ framework .Failf ("unable to wait for nodes to have positive allocatable resource: %v" , err )
135+ }
136+
137+ kustomYaml , err := utils .LocateRepoFile (tfKustomizationYaml )
138+ if err != nil {
139+ framework .Failf ("unable to locate %q: %v" , kustomYaml , err )
140+ }
141+
142+ ginkgo .By ("submitting demo deployment" )
143+
144+ e2ekubectl .RunKubectlOrDie (f .Namespace .Name , "apply" , "-k" , filepath .Dir (kustomYaml ))
145+
146+ ginkgo .By ("waiting the pod to finish successfully" )
147+ e2epod .NewPodClient (f ).WaitForSuccess (tfPodName , 60 * time .Second )
148+
149+ ginkgo .By ("checking log output" )
150+ log , err := e2epod .GetPodLogs (f .ClientSet , f .Namespace .Name , tfPodName , containerName )
151+
152+ if err != nil {
153+ framework .Failf ("unable to get log from pod: %v" , err )
154+ }
155+
156+ if ! strings .Contains (log , "SUCCESS" ) {
157+ framework .Failf ("tensorflow execution failed" )
158+ }
159+
160+ framework .Logf ("tensorflow execution succeeded!" )
161+ })
116162}
0 commit comments