@@ -49,7 +49,7 @@ func describeQatKernelPlugin() {
4949 framework .Failf ("unable to locate %q: %v" , qatPluginKernelYaml , err )
5050 }
5151
52- ginkgo .It ( "checks availability of QAT resources" , func () {
52+ ginkgo .BeforeEach ( func () {
5353 ginkgo .By ("deploying QAT plugin in kernel mode" )
5454 e2ekubectl .RunKubectlOrDie (f .Namespace .Name , "create" , "-f" , yamlPath )
5555
@@ -66,36 +66,42 @@ func describeQatKernelPlugin() {
6666 if err = utils .TestPodsFileSystemInfo (podList .Items ); err != nil {
6767 framework .Failf ("container filesystem info checks failed: %v" , err )
6868 }
69+ })
6970
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+ })
7478
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+ },
8894 },
8995 },
96+ RestartPolicy : v1 .RestartPolicyNever ,
9097 },
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" )
97102
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+ })
100106 })
101107}
0 commit comments