mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
e2e, qat: divide single It() to have multiple layers
Structure is as follows: Describe("QAT plugin") BeforeEach("deploys plugin") Context("When device resources are available") BeforeEach("checks if resources are available") It("runs a pod requesting resources") It("runs another pod requesting resources if there is") Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
This commit is contained in:
parent
77ad32e008
commit
3286baadb5
@ -57,7 +57,7 @@ func describeQatDpdkPlugin() {
|
||||
framework.Failf("unable to locate %q: %v", cryptoTestYaml, err)
|
||||
}
|
||||
|
||||
ginkgo.It("measures performance of DPDK", func() {
|
||||
ginkgo.BeforeEach(func() {
|
||||
ginkgo.By("deploying QAT plugin in DPDK mode")
|
||||
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
|
||||
|
||||
@ -74,22 +74,30 @@ func describeQatDpdkPlugin() {
|
||||
if err := utils.TestPodsFileSystemInfo(podList.Items); err != nil {
|
||||
framework.Failf("container filesystem info checks failed: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
ginkgo.By("checking if the resource is allocatable")
|
||||
if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/generic", 30*time.Second); err != nil {
|
||||
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
|
||||
}
|
||||
ginkgo.Context("When QAT 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 {
|
||||
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
ginkgo.By("submitting a crypto pod requesting QAT resources")
|
||||
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(cryptoTestYamlPath))
|
||||
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", "-k", filepath.Dir(cryptoTestYamlPath))
|
||||
|
||||
ginkgo.By("waiting the crypto pod to finish successfully")
|
||||
e2epod.NewPodClient(f).WaitForSuccess("qat-dpdk-test-crypto-perf-tc1", 60*time.Second)
|
||||
ginkgo.By("waiting the crypto pod to finish successfully")
|
||||
e2epod.NewPodClient(f).WaitForSuccess("qat-dpdk-test-crypto-perf-tc1", 60*time.Second)
|
||||
})
|
||||
|
||||
ginkgo.By("submitting a compress pod requesting QAT resources")
|
||||
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(compressTestYamlPath))
|
||||
ginkgo.It("deploys a compress pod requesting QAT resources", func() {
|
||||
ginkgo.By("submitting a compress pod requesting QAT resources")
|
||||
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(compressTestYamlPath))
|
||||
|
||||
ginkgo.By("waiting the compress pod to finish successfully")
|
||||
e2epod.NewPodClient(f).WaitForSuccess("qat-dpdk-test-compress-perf-tc1", 60*time.Second)
|
||||
ginkgo.By("waiting the compress pod to finish successfully")
|
||||
e2epod.NewPodClient(f).WaitForSuccess("qat-dpdk-test-compress-perf-tc1", 60*time.Second)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func describeQatKernelPlugin() {
|
||||
framework.Failf("unable to locate %q: %v", qatPluginKernelYaml, err)
|
||||
}
|
||||
|
||||
ginkgo.It("checks availability of QAT resources", func() {
|
||||
ginkgo.BeforeEach(func() {
|
||||
ginkgo.By("deploying QAT plugin in kernel mode")
|
||||
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "-f", yamlPath)
|
||||
|
||||
@ -66,36 +66,42 @@ func describeQatKernelPlugin() {
|
||||
if err = utils.TestPodsFileSystemInfo(podList.Items); err != nil {
|
||||
framework.Failf("container filesystem info checks failed: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
ginkgo.By("checking if the resource is allocatable")
|
||||
if err = utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/cy1_dc0", 30*time.Second); err != nil {
|
||||
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
|
||||
}
|
||||
ginkgo.Context("When QAT resources are available", func() {
|
||||
ginkgo.BeforeEach(func() {
|
||||
ginkgo.By("checking if the resource is allocatable")
|
||||
if err := utils.WaitForNodesWithResource(f.ClientSet, "qat.intel.com/cy1_dc0", 30*time.Second); err != nil {
|
||||
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
ginkgo.By("submitting a pod requesting QAT resources")
|
||||
podSpec := &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "qatplugin-tester"},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
{
|
||||
Args: []string{"-c", "echo mode"},
|
||||
Name: "testcontainer",
|
||||
Image: imageutils.GetE2EImage(imageutils.BusyBox),
|
||||
Command: []string{"/bin/sh"},
|
||||
Resources: v1.ResourceRequirements{
|
||||
Requests: v1.ResourceList{"qat.intel.com/cy1_dc0": resource.MustParse("1")},
|
||||
Limits: v1.ResourceList{"qat.intel.com/cy1_dc0": resource.MustParse("1")},
|
||||
ginkgo.It("deploys a pod requesting QAT resources", func() {
|
||||
ginkgo.By("submitting a pod requesting QAT resources")
|
||||
podSpec := &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "qatplugin-tester"},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
{
|
||||
Args: []string{"-c", "echo mode"},
|
||||
Name: "testcontainer",
|
||||
Image: imageutils.GetE2EImage(imageutils.BusyBox),
|
||||
Command: []string{"/bin/sh"},
|
||||
Resources: v1.ResourceRequirements{
|
||||
Requests: v1.ResourceList{"qat.intel.com/cy1_dc0": resource.MustParse("1")},
|
||||
Limits: v1.ResourceList{"qat.intel.com/cy1_dc0": resource.MustParse("1")},
|
||||
},
|
||||
},
|
||||
},
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
},
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
},
|
||||
}
|
||||
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(context.TODO(),
|
||||
podSpec, metav1.CreateOptions{})
|
||||
framework.ExpectNoError(err, "pod Create API error")
|
||||
}
|
||||
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(context.TODO(),
|
||||
podSpec, metav1.CreateOptions{})
|
||||
framework.ExpectNoError(err, "pod Create API error")
|
||||
|
||||
ginkgo.By("waiting the pod to finish successfully")
|
||||
e2epod.NewPodClient(f).WaitForFinish(pod.ObjectMeta.Name, 60*time.Second)
|
||||
ginkgo.By("waiting the pod to finish successfully")
|
||||
e2epod.NewPodClient(f).WaitForFinish(pod.ObjectMeta.Name, 60*time.Second)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func describeQatPluginCy() {
|
||||
framework.Failf("unable to locate %q: %v", opensslTestYaml, err)
|
||||
}
|
||||
|
||||
ginkgo.It("measures performance of QAT Cy Services", func() {
|
||||
ginkgo.BeforeEach(func() {
|
||||
ginkgo.By("deploying QAT plugin in DPDK mode")
|
||||
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
|
||||
|
||||
@ -68,20 +68,26 @@ func describeQatPluginCy() {
|
||||
if err := utils.TestPodsFileSystemInfo(podList.Items); err != nil {
|
||||
framework.Failf("container filesystem info checks failed: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
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.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.By("submitting a crypto pod requesting QAT resources")
|
||||
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", opensslTestYamlPath)
|
||||
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)
|
||||
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")
|
||||
output, _ := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, "openssl-qat-engine", "openssl-qat-engine")
|
||||
|
||||
framework.Logf("cpa_sample_code output:\n %s", output)
|
||||
framework.Logf("cpa_sample_code output:\n %s", output)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user