Skip to content

Commit 6a840b7

Browse files
authored
Merge pull request #1263 from hj-johannes-lee/e2e-segmentation
e2e: make tests divided into smaller parts (DLB, DSA, IAA, QAT)
2 parents 87dfdf9 + 3286baa commit 6a840b7

File tree

6 files changed

+240
-180
lines changed

6 files changed

+240
-180
lines changed

test/e2e/dlb/dlb.go

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func describe() {
4949
framework.Failf("unable to locate %q: %v", kustomizationYaml, err)
5050
}
5151

52-
ginkgo.It("runs DLB plugin and a demo workload", func() {
52+
ginkgo.BeforeEach(func() {
5353
ginkgo.By("deploying DLB plugin")
5454
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
5555

@@ -66,36 +66,56 @@ func describe() {
6666
if err = utils.TestPodsFileSystemInfo(podList.Items); err != nil {
6767
framework.Failf("container filesystem info checks failed: %v", err)
6868
}
69+
})
6970

70-
for _, resource := range []v1.ResourceName{"dlb.intel.com/pf", "dlb.intel.com/vf"} {
71-
ginkgo.By("checking if the " + resource.String() + " resource is allocatable")
72-
if err = utils.WaitForNodesWithResource(f.ClientSet, resource, 30*time.Second); err != nil {
71+
ginkgo.Context("When PF resources are available", func() {
72+
ginkgo.BeforeEach(func() {
73+
resource := v1.ResourceName("dlb.intel.com/pf")
74+
if err := utils.WaitForNodesWithResource(f.ClientSet, resource, 30*time.Second); err != nil {
7375
framework.Failf("unable to wait for nodes to have positive allocatable resource %s: %v", resource, err)
7476
}
75-
}
77+
})
7678

77-
for function, yaml := range map[string]string{"PF": demoPFYaml, "VF": demoVFYaml} {
78-
demoPath, err := utils.LocateRepoFile(yaml)
79-
if err != nil {
80-
framework.Failf("unable to locate %q: %v", yaml, err)
79+
ginkgo.It("can run demo app", func() {
80+
runDemoApp("PF", demoPFYaml, f)
81+
})
82+
})
83+
84+
ginkgo.Context("When VF resources are available", func() {
85+
ginkgo.BeforeEach(func() {
86+
resource := v1.ResourceName("dlb.intel.com/vf")
87+
if err := utils.WaitForNodesWithResource(f.ClientSet, resource, 30*time.Second); err != nil {
88+
framework.Failf("unable to wait for nodes to have positive allocatable resource %s: %v", resource, err)
8189
}
90+
})
8291

83-
podName := strings.TrimSuffix(filepath.Base(yaml), filepath.Ext(yaml))
92+
ginkgo.It("can run demo app", func() {
93+
runDemoApp("VF", demoVFYaml, f)
94+
})
95+
})
96+
}
8497

85-
ginkgo.By("submitting a pod requesting DLB " + function + " resources")
86-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", demoPath)
98+
func runDemoApp(function, yaml string, f *framework.Framework) {
99+
demoPath, err := utils.LocateRepoFile(yaml)
100+
if err != nil {
101+
framework.Failf("unable to locate %q: %v", yaml, err)
102+
}
87103

88-
ginkgo.By("waiting for the DLB demo to succeed")
89-
e2epod.NewPodClient(f).WaitForSuccess(podName, 200*time.Second)
104+
podName := strings.TrimSuffix(filepath.Base(yaml), filepath.Ext(yaml))
90105

91-
ginkgo.By("getting workload log")
92-
log, err := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, podName, podName)
106+
ginkgo.By("submitting a pod requesting DLB " + function + " resources")
107+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", demoPath)
93108

94-
if err != nil {
95-
framework.Failf("unable to get log from pod: %v", err)
96-
}
109+
ginkgo.By("waiting for the DLB demo to succeed")
110+
e2epod.NewPodClient(f).WaitForSuccess(podName, 200*time.Second)
97111

98-
framework.Logf("log output: %s", log)
99-
}
100-
})
112+
ginkgo.By("getting workload log")
113+
114+
log, err := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, podName, podName)
115+
116+
if err != nil {
117+
framework.Failf("unable to get log from pod: %v", err)
118+
}
119+
120+
framework.Logf("log output: %s", log)
101121
}

test/e2e/dsa/dsa.go

Lines changed: 62 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -60,65 +60,75 @@ func describe() {
6060
framework.Failf("unable to locate %q: %v", demoYaml, err)
6161
}
6262

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+
})
101109
})
102110

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")
105114

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+
}
109118

110-
utils.Kubectl("", "apply", "-f", "deployments/operator/samples/deviceplugin_v1_dsadeviceplugin.yaml")
119+
utils.Kubectl("", "apply", "-f", "deployments/operator/samples/deviceplugin_v1_dsadeviceplugin.yaml")
111120

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+
}
115124

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+
}
119128

120-
utils.Kubectl("", "delete", "-f", "deployments/operator/samples/deviceplugin_v1_dsadeviceplugin.yaml")
129+
utils.Kubectl("", "delete", "-f", "deployments/operator/samples/deviceplugin_v1_dsadeviceplugin.yaml")
121130

122-
utils.Kubectl("", "delete", "-k", "deployments/operator/default/kustomization.yaml")
131+
utils.Kubectl("", "delete", "-k", "deployments/operator/default/kustomization.yaml")
132+
})
123133
})
124134
}

test/e2e/iaa/iaa.go

Lines changed: 62 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -60,65 +60,75 @@ func describe() {
6060
framework.Failf("unable to locate %q: %v", demoYaml, err)
6161
}
6262

63-
ginkgo.It("runs IAA plugin and a demo workload", func() {
64-
ginkgo.By("deploying IAA plugin")
65-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "intel-iaa-config", "--from-file="+configmap)
66-
67-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
68-
69-
ginkgo.By("waiting for IAA plugin's availability")
70-
podList, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, f.Namespace.Name,
71-
labels.Set{"app": "intel-iaa-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 IAA 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, "iaa.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 IAA demo to succeed")
91-
e2epod.NewPodClient(f).WaitForSuccess(podName, 300*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 IAA plugin")
66+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "intel-iaa-config", "--from-file="+configmap)
67+
68+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
69+
70+
ginkgo.By("waiting for IAA plugin's availability")
71+
podList, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, f.Namespace.Name,
72+
labels.Set{"app": "intel-iaa-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 IAA 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 IAA resources are available", func() {
86+
ginkgo.BeforeEach(func() {
87+
ginkgo.By("checking if the resource is allocatable")
88+
if err := utils.WaitForNodesWithResource(f.ClientSet, "iaa.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 IAA demo to succeed")
97+
e2epod.NewPodClient(f).WaitForSuccess(podName, 300*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+
})
101109
})
102110

103-
ginkgo.It("deploys IAA 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 IAA plugin with operator", func() {
113+
utils.Kubectl("", "apply", "-k", "deployments/operator/default/kustomization.yaml")
105114

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+
}
109118

110-
utils.Kubectl("", "apply", "-f", "deployments/operator/samples/deviceplugin_v1_iaadeviceplugin.yaml")
119+
utils.Kubectl("", "apply", "-f", "deployments/operator/samples/deviceplugin_v1_iaadeviceplugin.yaml")
111120

112-
if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"app": "intel-iaa-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-iaa-plugin"}.AsSelector(), 1, timeout); err != nil {
122+
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
123+
}
115124

116-
if err := utils.WaitForNodesWithResource(f.ClientSet, "iaa.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, "iaa.intel.com/wq-user-dedicated", timeout); err != nil {
126+
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
127+
}
119128

120-
utils.Kubectl("", "delete", "-f", "deployments/operator/samples/deviceplugin_v1_iaadeviceplugin.yaml")
129+
utils.Kubectl("", "delete", "-f", "deployments/operator/samples/deviceplugin_v1_iaadeviceplugin.yaml")
121130

122-
utils.Kubectl("", "delete", "-k", "deployments/operator/default/kustomization.yaml")
131+
utils.Kubectl("", "delete", "-k", "deployments/operator/default/kustomization.yaml")
132+
})
123133
})
124134
}

test/e2e/qat/qatplugin_dpdk.go

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func describeQatDpdkPlugin() {
5757
framework.Failf("unable to locate %q: %v", cryptoTestYaml, err)
5858
}
5959

60-
ginkgo.It("measures performance of DPDK", func() {
60+
ginkgo.BeforeEach(func() {
6161
ginkgo.By("deploying QAT plugin in DPDK mode")
6262
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
6363

@@ -74,22 +74,30 @@ func describeQatDpdkPlugin() {
7474
if err := utils.TestPodsFileSystemInfo(podList.Items); err != nil {
7575
framework.Failf("container filesystem info checks failed: %v", err)
7676
}
77+
})
7778

78-
ginkgo.By("checking if the resource is allocatable")
79-
if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/generic", 30*time.Second); err != nil {
80-
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
81-
}
82-
83-
ginkgo.By("submitting a crypto pod requesting QAT resources")
84-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(cryptoTestYamlPath))
85-
86-
ginkgo.By("waiting the crypto pod to finish successfully")
87-
e2epod.NewPodClient(f).WaitForSuccess("qat-dpdk-test-crypto-perf-tc1", 60*time.Second)
88-
89-
ginkgo.By("submitting a compress pod requesting QAT resources")
90-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(compressTestYamlPath))
91-
92-
ginkgo.By("waiting the compress pod to finish successfully")
93-
e2epod.NewPodClient(f).WaitForSuccess("qat-dpdk-test-compress-perf-tc1", 60*time.Second)
79+
ginkgo.Context("When QAT resources are available", func() {
80+
ginkgo.BeforeEach(func() {
81+
ginkgo.By("checking if the resource is allocatable")
82+
if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/generic", 30*time.Second); err != nil {
83+
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
84+
}
85+
})
86+
87+
ginkgo.It("deploys a crypto pod requesting QAT resources", func() {
88+
ginkgo.By("submitting a crypto pod requesting QAT resources")
89+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(cryptoTestYamlPath))
90+
91+
ginkgo.By("waiting the crypto pod to finish successfully")
92+
e2epod.NewPodClient(f).WaitForSuccess("qat-dpdk-test-crypto-perf-tc1", 60*time.Second)
93+
})
94+
95+
ginkgo.It("deploys a compress pod requesting QAT resources", func() {
96+
ginkgo.By("submitting a compress pod requesting QAT resources")
97+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(compressTestYamlPath))
98+
99+
ginkgo.By("waiting the compress pod to finish successfully")
100+
e2epod.NewPodClient(f).WaitForSuccess("qat-dpdk-test-compress-perf-tc1", 60*time.Second)
101+
})
94102
})
95103
}

0 commit comments

Comments
 (0)