diff --git a/Makefile b/Makefile index 8885c4f4..dbabefbf 100644 --- a/Makefile +++ b/Makefile @@ -143,7 +143,7 @@ e2e-fpga: @$(GO) test -v ./test/e2e/... -ginkgo.v -ginkgo.progress -ginkgo.focus "FPGA" -delete-namespace-on-failure=false e2e-qat: - @$(GO) test -v ./test/e2e/... -ginkgo.v -ginkgo.progress -ginkgo.focus "QAT plugin in DPDK mode" -delete-namespace-on-failure=false + @$(GO) test -v ./test/e2e/... -ginkgo.v -ginkgo.progress -ginkgo.focus "QAT Gen2" -delete-namespace-on-failure=false e2e-qat4: @$(GO) test -v ./test/e2e/... -ginkgo.v -ginkgo.progress -ginkgo.focus "QAT Gen4" -delete-namespace-on-failure=false diff --git a/test/e2e/qat/qatplugin_dpdk.go b/test/e2e/qat/qatplugin_dpdk.go index 1c435efc..2f38d2e0 100644 --- a/test/e2e/qat/qatplugin_dpdk.go +++ b/test/e2e/qat/qatplugin_dpdk.go @@ -29,9 +29,10 @@ import ( ) const ( - dpdkKustomizationYaml = "deployments/qat_plugin/overlays/e2e/kustomization.yaml" - compressTestYaml = "deployments/qat_dpdk_app/test-compress1/kustomization.yaml" - cryptoTestYaml = "deployments/qat_dpdk_app/test-crypto1/kustomization.yaml" + qatPluginKustomizationYaml = "deployments/qat_plugin/overlays/e2e/kustomization.yaml" + opensslTestYaml = "demo/openssl-qat-engine-cpa-sample-pod.yaml" + compressTestYaml = "deployments/qat_dpdk_app/test-compress1/kustomization.yaml" + cryptoTestYaml = "deployments/qat_dpdk_app/test-crypto1/kustomization.yaml" ) func init() { @@ -42,9 +43,9 @@ func describeQatDpdkPlugin() { f := framework.NewDefaultFramework("qatplugindpdk") f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged - kustomizationPath, err := utils.LocateRepoFile(dpdkKustomizationYaml) + kustomizationPath, err := utils.LocateRepoFile(qatPluginKustomizationYaml) if err != nil { - framework.Failf("unable to locate %q: %v", dpdkKustomizationYaml, err) + framework.Failf("unable to locate %q: %v", qatPluginKustomizationYaml, err) } compressTestYamlPath, err := utils.LocateRepoFile(compressTestYaml) @@ -57,6 +58,11 @@ func describeQatDpdkPlugin() { framework.Failf("unable to locate %q: %v", cryptoTestYaml, err) } + opensslTestYamlPath, err := utils.LocateRepoFile(opensslTestYaml) + if err != nil { + framework.Failf("unable to locate %q: %v", opensslTestYaml, err) + } + ginkgo.BeforeEach(func() { ginkgo.By("deploying QAT plugin in DPDK mode") e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath)) @@ -76,7 +82,27 @@ func describeQatDpdkPlugin() { } }) - ginkgo.Context("When QAT resources are available", func() { + ginkgo.Context("When QAT Gen4 resources are available", func() { + ginkgo.BeforeEach(func() { + ginkgo.By("checking if the resource is allocatable") + if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/cy", 30*time.Second); err != nil { + framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err) + } + }) + + ginkgo.It("deploys a crypto pod requesting QAT resources", func() { + ginkgo.By("submitting a crypto pod requesting QAT resources") + e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", opensslTestYamlPath) + + ginkgo.By("waiting the crypto pod to finish successfully") + e2epod.NewPodClient(f).WaitForSuccess("openssl-qat-engine", 300*time.Second) + + output, _ := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, "openssl-qat-engine", "openssl-qat-engine") + + framework.Logf("cpa_sample_code output:\n %s", output) + }) + }) + ginkgo.Context("When QAT Gen2 resources are available", func() { ginkgo.BeforeEach(func() { ginkgo.By("checking if the resource is allocatable") if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/generic", 30*time.Second); err != nil { diff --git a/test/e2e/qat/qatplugin_qatgen4_crypto.go b/test/e2e/qat/qatplugin_qatgen4_crypto.go deleted file mode 100644 index cbe1b593..00000000 --- a/test/e2e/qat/qatplugin_qatgen4_crypto.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2022 Intel Corporation. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package qat - -import ( - "path/filepath" - "time" - - "github.com/intel/intel-device-plugins-for-kubernetes/test/e2e/utils" - "github.com/onsi/ginkgo/v2" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/kubernetes/test/e2e/framework" - e2edebug "k8s.io/kubernetes/test/e2e/framework/debug" - e2ekubectl "k8s.io/kubernetes/test/e2e/framework/kubectl" - e2epod "k8s.io/kubernetes/test/e2e/framework/pod" - admissionapi "k8s.io/pod-security-admission/api" -) - -const ( - qatPluginKustomizationYaml = "deployments/qat_plugin/overlays/e2e/kustomization.yaml" - opensslTestYaml = "demo/openssl-qat-engine-cpa-sample-pod.yaml" -) - -func init() { - ginkgo.Describe("QAT Gen4 plugin in Crypto mode", describeQatPluginCy) -} - -func describeQatPluginCy() { - f := framework.NewDefaultFramework("qatplugincy") - f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged - - kustomizationPath, err := utils.LocateRepoFile(qatPluginKustomizationYaml) - if err != nil { - framework.Failf("unable to locate %q: %v", qatPluginKustomizationYaml, err) - } - - opensslTestYamlPath, err := utils.LocateRepoFile(opensslTestYaml) - if err != nil { - framework.Failf("unable to locate %q: %v", opensslTestYaml, err) - } - - ginkgo.BeforeEach(func() { - ginkgo.By("deploying QAT plugin in DPDK mode") - e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath)) - - ginkgo.By("waiting for QAT plugin's availability") - podList, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, f.Namespace.Name, - labels.Set{"app": "intel-qat-plugin"}.AsSelector(), 1 /* one replica */, 100*time.Second) - if err != nil { - e2edebug.DumpAllNamespaceInfo(f.ClientSet, f.Namespace.Name) - e2ekubectl.LogFailedContainers(f.ClientSet, f.Namespace.Name, framework.Logf) - framework.Failf("unable to wait for all pods to be running and ready: %v", err) - } - - ginkgo.By("checking QAT plugin's securityContext") - if err := utils.TestPodsFileSystemInfo(podList.Items); err != nil { - framework.Failf("container filesystem info checks failed: %v", err) - } - }) - - ginkgo.Context("When QAT4 resources are available", func() { - ginkgo.BeforeEach(func() { - ginkgo.By("checking if the resource is allocatable") - if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/cy", 30*time.Second); err != nil { - framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err) - } - }) - - ginkgo.It("deploys a crypto pod requesting QAT resources", func() { - ginkgo.By("submitting a crypto pod requesting QAT resources") - e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", opensslTestYamlPath) - - ginkgo.By("waiting the crypto pod to finish successfully") - e2epod.NewPodClient(f).WaitForSuccess("openssl-qat-engine", 300*time.Second) - - output, _ := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, "openssl-qat-engine", "openssl-qat-engine") - - framework.Logf("cpa_sample_code output:\n %s", output) - }) - }) -}