@@ -49,7 +49,7 @@ func describeQatKernelPlugin() {
49
49
framework .Failf ("unable to locate %q: %v" , qatPluginKernelYaml , err )
50
50
}
51
51
52
- ginkgo .It ( "checks availability of QAT resources" , func () {
52
+ ginkgo .BeforeEach ( func () {
53
53
ginkgo .By ("deploying QAT plugin in kernel mode" )
54
54
e2ekubectl .RunKubectlOrDie (f .Namespace .Name , "create" , "-f" , yamlPath )
55
55
@@ -66,36 +66,42 @@ func describeQatKernelPlugin() {
66
66
if err = utils .TestPodsFileSystemInfo (podList .Items ); err != nil {
67
67
framework .Failf ("container filesystem info checks failed: %v" , err )
68
68
}
69
+ })
69
70
70
- ginkgo .By ("checking if the resource is allocatable" )
71
- if err = utils .WaitForNodesWithResource (f .ClientSet , "qat.intel.com/cy1_dc0" , 30 * time .Second ); err != nil {
72
- framework .Failf ("unable to wait for nodes to have positive allocatable resource: %v" , err )
73
- }
71
+ ginkgo .Context ("When QAT resources are available" , func () {
72
+ ginkgo .BeforeEach (func () {
73
+ ginkgo .By ("checking if the resource is allocatable" )
74
+ if err := utils .WaitForNodesWithResource (f .ClientSet , "qat.intel.com/cy1_dc0" , 30 * time .Second ); err != nil {
75
+ framework .Failf ("unable to wait for nodes to have positive allocatable resource: %v" , err )
76
+ }
77
+ })
74
78
75
- ginkgo .By ("submitting a pod requesting QAT resources" )
76
- podSpec := & v1.Pod {
77
- ObjectMeta : metav1.ObjectMeta {Name : "qatplugin-tester" },
78
- Spec : v1.PodSpec {
79
- Containers : []v1.Container {
80
- {
81
- Args : []string {"-c" , "echo mode" },
82
- Name : "testcontainer" ,
83
- Image : imageutils .GetE2EImage (imageutils .BusyBox ),
84
- Command : []string {"/bin/sh" },
85
- Resources : v1.ResourceRequirements {
86
- Requests : v1.ResourceList {"qat.intel.com/cy1_dc0" : resource .MustParse ("1" )},
87
- Limits : v1.ResourceList {"qat.intel.com/cy1_dc0" : resource .MustParse ("1" )},
79
+ ginkgo .It ("deploys a pod requesting QAT resources" , func () {
80
+ ginkgo .By ("submitting a pod requesting QAT resources" )
81
+ podSpec := & v1.Pod {
82
+ ObjectMeta : metav1.ObjectMeta {Name : "qatplugin-tester" },
83
+ Spec : v1.PodSpec {
84
+ Containers : []v1.Container {
85
+ {
86
+ Args : []string {"-c" , "echo mode" },
87
+ Name : "testcontainer" ,
88
+ Image : imageutils .GetE2EImage (imageutils .BusyBox ),
89
+ Command : []string {"/bin/sh" },
90
+ Resources : v1.ResourceRequirements {
91
+ Requests : v1.ResourceList {"qat.intel.com/cy1_dc0" : resource .MustParse ("1" )},
92
+ Limits : v1.ResourceList {"qat.intel.com/cy1_dc0" : resource .MustParse ("1" )},
93
+ },
88
94
},
89
95
},
96
+ RestartPolicy : v1 .RestartPolicyNever ,
90
97
},
91
- RestartPolicy : v1 .RestartPolicyNever ,
92
- },
93
- }
94
- pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (context .TODO (),
95
- podSpec , metav1.CreateOptions {})
96
- framework .ExpectNoError (err , "pod Create API error" )
98
+ }
99
+ pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (context .TODO (),
100
+ podSpec , metav1.CreateOptions {})
101
+ framework .ExpectNoError (err , "pod Create API error" )
97
102
98
- ginkgo .By ("waiting the pod to finish successfully" )
99
- e2epod .NewPodClient (f ).WaitForFinish (pod .ObjectMeta .Name , 60 * time .Second )
103
+ ginkgo .By ("waiting the pod to finish successfully" )
104
+ e2epod .NewPodClient (f ).WaitForFinish (pod .ObjectMeta .Name , 60 * time .Second )
105
+ })
100
106
})
101
107
}
0 commit comments