Skip to content

Commit 142ec19

Browse files
QAT, e2e: add qat-engine's testapp case
1 parent 4da1633 commit 142ec19

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test/e2e/qat/qatplugin_dpdk.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ func describeQatDpdkPlugin() {
137137
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, "qat-dpdk-test-crypto-perf", "crypto-perf"))
138138
})
139139

140+
ginkgo.It("deploys a crypto pod (qat-engine testapp) [App:qat-engine]", func(ctx context.Context) {
141+
runQatEngineTestApp(ctx, f, resourceName)
142+
})
143+
140144
ginkgo.When("there is no app to run [App:noapp]", func() {
141145
ginkgo.It("does nothing", func() {})
142146
})
@@ -251,6 +255,39 @@ func runCpaSampleCode(ctx context.Context, f *framework.Framework, runTests int,
251255
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, pod.ObjectMeta.Name, pod.Spec.Containers[0].Name))
252256
}
253257

258+
func runQatEngineTestApp(ctx context.Context, f *framework.Framework, resourceName v1.ResourceName) {
259+
ginkgo.By("submitting a pod requesting QAT" + resourceName.String() + "resources")
260+
podSpec := &v1.Pod{
261+
ObjectMeta: metav1.ObjectMeta{Name: "openssl-qat-engine"},
262+
Spec: v1.PodSpec{
263+
Containers: []v1.Container{
264+
{
265+
Name: "openssl-qat-engine",
266+
Image: "intel/openssl-qat-engine:devel",
267+
ImagePullPolicy: "IfNotPresent",
268+
Command: []string{"testapp", "-engine", "qatengine", "-async_jobs", "1", "-c", "1", "-n", "1", "-nc", "1", "-v", "-hw_algo", "0x0029"},
269+
SecurityContext: &v1.SecurityContext{
270+
Capabilities: &v1.Capabilities{
271+
Add: []v1.Capability{"IPC_LOCK"}},
272+
},
273+
Resources: v1.ResourceRequirements{
274+
Requests: v1.ResourceList{resourceName: resource.MustParse("1")},
275+
Limits: v1.ResourceList{resourceName: resource.MustParse("1")},
276+
},
277+
},
278+
},
279+
RestartPolicy: v1.RestartPolicyNever,
280+
},
281+
}
282+
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(ctx, podSpec, metav1.CreateOptions{})
283+
framework.ExpectNoError(err, "pod Create API error")
284+
285+
ginkgo.By("waiting the qat-engine's testapp pod for the resource" + resourceName.String() + "to finish successfully")
286+
287+
err = e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, pod.ObjectMeta.Name, f.Namespace.Name, 300*time.Second)
288+
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, pod.ObjectMeta.Name, pod.Spec.Containers[0].Name))
289+
}
290+
254291
func injectError(ctx context.Context, f *framework.Framework, resourceName v1.ResourceName) {
255292
nodeName, _ := utils.FindNodeAndResourceCapacity(f, ctx, resourceName.String())
256293
if nodeName == "" {

0 commit comments

Comments
 (0)