Skip to content

Commit fe8a196

Browse files
e2e: update qat gen4 test case to deal with configMap
Add a process to create a configMap for cy service The structure of e2e test flows is as follows: BeforeEach(createing a configMap) JustBeforeEach(deploying QAT plugin) Context( - BeforeEach(checks if resources are available) - It(runs a test pod) [- It(runs another test pod)]* ) Signed-off-by: Hyeongju Johannes Lee <[email protected]>
1 parent 1a41402 commit fe8a196

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

test/e2e/qat/qatplugin_dpdk.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020

2121
"github.com/intel/intel-device-plugins-for-kubernetes/test/e2e/utils"
2222
"github.com/onsi/ginkgo/v2"
23+
v1 "k8s.io/api/core/v1"
2324
"k8s.io/apimachinery/pkg/labels"
2425
"k8s.io/kubernetes/test/e2e/framework"
2526
e2edebug "k8s.io/kubernetes/test/e2e/framework/debug"
@@ -65,7 +66,9 @@ func describeQatDpdkPlugin() {
6566

6667
var dpPodName string
6768

68-
ginkgo.BeforeEach(func() {
69+
var resourceName v1.ResourceName
70+
71+
ginkgo.JustBeforeEach(func() {
6972
ginkgo.By("deploying QAT plugin in DPDK mode")
7073
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
7174

@@ -83,6 +86,11 @@ func describeQatDpdkPlugin() {
8386
if err := utils.TestPodsFileSystemInfo(podList.Items); err != nil {
8487
framework.Failf("container filesystem info checks failed: %v", err)
8588
}
89+
90+
ginkgo.By("checking if the resource is allocatable")
91+
if err := utils.WaitForNodesWithResource(f.ClientSet, resourceName, 30*time.Second); err != nil {
92+
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
93+
}
8694
})
8795

8896
ginkgo.AfterEach(func() {
@@ -93,12 +101,14 @@ func describeQatDpdkPlugin() {
93101
}
94102
})
95103

96-
ginkgo.Context("When QAT Gen4 resources are available", func() {
104+
ginkgo.Context("When QAT Gen4 resources are available with crypto (cy) services enabled", func() {
105+
// This BeforeEach runs even before the JustBeforeEach above.
97106
ginkgo.BeforeEach(func() {
98-
ginkgo.By("checking if the resource is allocatable")
99-
if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/cy", 30*time.Second); err != nil {
100-
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
101-
}
107+
ginkgo.By("creating a configMap before plugin gets deployed")
108+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "--from-literal", "qat.conf=ServicesEnabled=sym;asym", "qat-config")
109+
110+
ginkgo.By("setting resourceName for cy services")
111+
resourceName = "qat.intel.com/cy"
102112
})
103113

104114
ginkgo.It("deploys a crypto pod requesting QAT resources", func() {
@@ -116,10 +126,8 @@ func describeQatDpdkPlugin() {
116126

117127
ginkgo.Context("When QAT Gen2 resources are available", func() {
118128
ginkgo.BeforeEach(func() {
119-
ginkgo.By("checking if the resource is allocatable")
120-
if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/generic", 30*time.Second); err != nil {
121-
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
122-
}
129+
ginkgo.By("setting resourceName for Gen2 resources")
130+
resourceName = "qat.intel.com/generic"
123131
})
124132

125133
ginkgo.It("deploys a crypto pod requesting QAT resources", func() {

0 commit comments

Comments
 (0)