Skip to content

Commit

Permalink
QAT, e2e: add qat-engine's testapp case
Browse files Browse the repository at this point in the history
  • Loading branch information
hj-johannes-lee committed Oct 18, 2024
1 parent b4f2b72 commit 693c654
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/e2e/qat/qatplugin_dpdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ func describeQatDpdkPlugin() {
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, "qat-dpdk-test-crypto-perf", "crypto-perf"))
})

ginkgo.It("deploys a crypto pod (qat-engine testapp) [App:qat-engine]", func(ctx context.Context) {
runQatEngineTestApp(ctx, f, resourceName)
})

ginkgo.When("there is no app to run [App:noapp]", func() {
ginkgo.It("does nothing", func() {})
})
Expand Down Expand Up @@ -251,6 +255,39 @@ func runCpaSampleCode(ctx context.Context, f *framework.Framework, runTests int,
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, pod.ObjectMeta.Name, pod.Spec.Containers[0].Name))
}

func runQatEngineTestApp(ctx context.Context, f *framework.Framework, resourceName v1.ResourceName) {
ginkgo.By("submitting a pod requesting QAT" + resourceName.String() + "resources")
podSpec := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{Name: "openssl-qat-engine"},
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Name: "openssl-qat-engine",
Image: "intel/openssl-qat-engine:devel",
ImagePullPolicy: "IfNotPresent",
Command: []string{"testapp", "-engine", "qatengine", "-async_jobs", "1", "-c", "1", "-n", "1", "-nc", "1", "-v", "-hw_algo", "0x0029"},
SecurityContext: &v1.SecurityContext{
Capabilities: &v1.Capabilities{
Add: []v1.Capability{"IPC_LOCK"}},
},
Resources: v1.ResourceRequirements{
Requests: v1.ResourceList{resourceName: resource.MustParse("1")},
Limits: v1.ResourceList{resourceName: resource.MustParse("1")},
},
},
},
RestartPolicy: v1.RestartPolicyNever,
},
}
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(ctx, podSpec, metav1.CreateOptions{})
framework.ExpectNoError(err, "pod Create API error")

ginkgo.By("waiting the qat-engine's testapp pod for the resource" + resourceName.String() + "to finish successfully")

err = e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, pod.ObjectMeta.Name, f.Namespace.Name, 300*time.Second)
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, pod.ObjectMeta.Name, pod.Spec.Containers[0].Name))
}

func injectError(ctx context.Context, f *framework.Framework, resourceName v1.ResourceName) {
nodeName, _ := utils.FindNodeAndResourceCapacity(f, ctx, resourceName.String())
if nodeName == "" {
Expand Down

0 comments on commit 693c654

Please sign in to comment.