@@ -60,65 +60,75 @@ func describe() {
60
60
framework .Failf ("unable to locate %q: %v" , demoYaml , err )
61
61
}
62
62
63
- ginkgo .It ("runs DSA plugin and a demo workload" , func () {
64
- ginkgo .By ("deploying DSA plugin" )
65
- e2ekubectl .RunKubectlOrDie (f .Namespace .Name , "create" , "configmap" , "intel-dsa-config" , "--from-file=" + configmap )
66
-
67
- e2ekubectl .RunKubectlOrDie (f .Namespace .Name , "apply" , "-k" , filepath .Dir (kustomizationPath ))
68
-
69
- ginkgo .By ("waiting for DSA plugin's availability" )
70
- podList , err := e2epod .WaitForPodsWithLabelRunningReady (f .ClientSet , f .Namespace .Name ,
71
- labels.Set {"app" : "intel-dsa-plugin" }.AsSelector (), 1 /* one replica */ , 300 * time .Second )
72
- if err != nil {
73
- e2edebug .DumpAllNamespaceInfo (f .ClientSet , f .Namespace .Name )
74
- e2ekubectl .LogFailedContainers (f .ClientSet , f .Namespace .Name , framework .Logf )
75
- framework .Failf ("unable to wait for all pods to be running and ready: %v" , err )
76
- }
77
-
78
- ginkgo .By ("checking DSA plugin's securityContext" )
79
- if err = utils .TestPodsFileSystemInfo (podList .Items ); err != nil {
80
- framework .Failf ("container filesystem info checks failed: %v" , err )
81
- }
82
-
83
- ginkgo .By ("checking if the resource is allocatable" )
84
- if err = utils .WaitForNodesWithResource (f .ClientSet , "dsa.intel.com/wq-user-dedicated" , 300 * time .Second ); err != nil {
85
- framework .Failf ("unable to wait for nodes to have positive allocatable resource: %v" , err )
86
- }
87
-
88
- e2ekubectl .RunKubectlOrDie (f .Namespace .Name , "apply" , "-f" , demoPath )
89
-
90
- ginkgo .By ("waiting for the DSA demo to succeed" )
91
- e2epod .NewPodClient (f ).WaitForSuccess (podName , 200 * time .Second )
92
-
93
- ginkgo .By ("getting workload log" )
94
- log , err := e2epod .GetPodLogs (f .ClientSet , f .Namespace .Name , podName , podName )
95
-
96
- if err != nil {
97
- framework .Failf ("unable to get log from pod: %v" , err )
98
- }
99
-
100
- framework .Logf ("log output: %s" , log )
63
+ ginkgo .Describe ("Without using operator" , func () {
64
+ ginkgo .BeforeEach (func () {
65
+ ginkgo .By ("deploying DSA plugin" )
66
+ e2ekubectl .RunKubectlOrDie (f .Namespace .Name , "create" , "configmap" , "intel-dsa-config" , "--from-file=" + configmap )
67
+
68
+ e2ekubectl .RunKubectlOrDie (f .Namespace .Name , "apply" , "-k" , filepath .Dir (kustomizationPath ))
69
+
70
+ ginkgo .By ("waiting for DSA plugin's availability" )
71
+ podList , err := e2epod .WaitForPodsWithLabelRunningReady (f .ClientSet , f .Namespace .Name ,
72
+ labels.Set {"app" : "intel-dsa-plugin" }.AsSelector (), 1 /* one replica */ , 300 * time .Second )
73
+ if err != nil {
74
+ e2edebug .DumpAllNamespaceInfo (f .ClientSet , f .Namespace .Name )
75
+ e2ekubectl .LogFailedContainers (f .ClientSet , f .Namespace .Name , framework .Logf )
76
+ framework .Failf ("unable to wait for all pods to be running and ready: %v" , err )
77
+ }
78
+
79
+ ginkgo .By ("checking DSA plugin's securityContext" )
80
+ if err = utils .TestPodsFileSystemInfo (podList .Items ); err != nil {
81
+ framework .Failf ("container filesystem info checks failed: %v" , err )
82
+ }
83
+ })
84
+
85
+ ginkgo .Context ("When DSA resources are available" , func () {
86
+ ginkgo .BeforeEach (func () {
87
+ ginkgo .By ("checking if the resource is allocatable" )
88
+ if err := utils .WaitForNodesWithResource (f .ClientSet , "dsa.intel.com/wq-user-dedicated" , 300 * time .Second ); err != nil {
89
+ framework .Failf ("unable to wait for nodes to have positive allocatable resource: %v" , err )
90
+ }
91
+ })
92
+
93
+ ginkgo .It ("deploys a demo app" , func () {
94
+ e2ekubectl .RunKubectlOrDie (f .Namespace .Name , "apply" , "-f" , demoPath )
95
+
96
+ ginkgo .By ("waiting for the DSA demo to succeed" )
97
+ e2epod .NewPodClient (f ).WaitForSuccess (podName , 200 * time .Second )
98
+
99
+ ginkgo .By ("getting workload log" )
100
+ log , err := e2epod .GetPodLogs (f .ClientSet , f .Namespace .Name , podName , podName )
101
+
102
+ if err != nil {
103
+ framework .Failf ("unable to get log from pod: %v" , err )
104
+ }
105
+
106
+ framework .Logf ("log output: %s" , log )
107
+ })
108
+ })
101
109
})
102
110
103
- ginkgo .It ("deploys DSA plugin with operator" , func () {
104
- utils .Kubectl ("" , "apply" , "-k" , "deployments/operator/default/kustomization.yaml" )
111
+ ginkgo .Describe ("With using operator" , func () {
112
+ ginkgo .It ("deploys DSA plugin with operator" , func () {
113
+ utils .Kubectl ("" , "apply" , "-k" , "deployments/operator/default/kustomization.yaml" )
105
114
106
- if _ , err := e2epod .WaitForPodsWithLabelRunningReady (f .ClientSet , ns , labels.Set {"control-plane" : "controller-manager" }.AsSelector (), 1 , timeout ); err != nil {
107
- framework .Failf ("unable to wait for all pods to be running and ready: %v" , err )
108
- }
115
+ if _ , err := e2epod .WaitForPodsWithLabelRunningReady (f .ClientSet , ns , labels.Set {"control-plane" : "controller-manager" }.AsSelector (), 1 , timeout ); err != nil {
116
+ framework .Failf ("unable to wait for all pods to be running and ready: %v" , err )
117
+ }
109
118
110
- utils .Kubectl ("" , "apply" , "-f" , "deployments/operator/samples/deviceplugin_v1_dsadeviceplugin.yaml" )
119
+ utils .Kubectl ("" , "apply" , "-f" , "deployments/operator/samples/deviceplugin_v1_dsadeviceplugin.yaml" )
111
120
112
- if _ , err := e2epod .WaitForPodsWithLabelRunningReady (f .ClientSet , ns , labels.Set {"app" : "intel-dsa-plugin" }.AsSelector (), 1 , timeout ); err != nil {
113
- framework .Failf ("unable to wait for all pods to be running and ready: %v" , err )
114
- }
121
+ if _ , err := e2epod .WaitForPodsWithLabelRunningReady (f .ClientSet , ns , labels.Set {"app" : "intel-dsa-plugin" }.AsSelector (), 1 , timeout ); err != nil {
122
+ framework .Failf ("unable to wait for all pods to be running and ready: %v" , err )
123
+ }
115
124
116
- if err := utils .WaitForNodesWithResource (f .ClientSet , "dsa.intel.com/wq-user-dedicated" , timeout ); err != nil {
117
- framework .Failf ("unable to wait for nodes to have positive allocatable resource: %v" , err )
118
- }
125
+ if err := utils .WaitForNodesWithResource (f .ClientSet , "dsa.intel.com/wq-user-dedicated" , timeout ); err != nil {
126
+ framework .Failf ("unable to wait for nodes to have positive allocatable resource: %v" , err )
127
+ }
119
128
120
- utils .Kubectl ("" , "delete" , "-f" , "deployments/operator/samples/deviceplugin_v1_dsadeviceplugin.yaml" )
129
+ utils .Kubectl ("" , "delete" , "-f" , "deployments/operator/samples/deviceplugin_v1_dsadeviceplugin.yaml" )
121
130
122
- utils .Kubectl ("" , "delete" , "-k" , "deployments/operator/default/kustomization.yaml" )
131
+ utils .Kubectl ("" , "delete" , "-k" , "deployments/operator/default/kustomization.yaml" )
132
+ })
123
133
})
124
134
}
0 commit comments