Skip to content

e2e: make tests divided into smaller parts (DLB, DSA, IAA, QAT) #1263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 42 additions & 22 deletions test/e2e/dlb/dlb.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func describe() {
framework.Failf("unable to locate %q: %v", kustomizationYaml, err)
}

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

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

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

for function, yaml := range map[string]string{"PF": demoPFYaml, "VF": demoVFYaml} {
demoPath, err := utils.LocateRepoFile(yaml)
if err != nil {
framework.Failf("unable to locate %q: %v", yaml, err)
ginkgo.It("can run demo app", func() {
runDemoApp("PF", demoPFYaml, f)
})
})

ginkgo.Context("When VF resources are available", func() {
ginkgo.BeforeEach(func() {
resource := v1.ResourceName("dlb.intel.com/vf")
if err := utils.WaitForNodesWithResource(f.ClientSet, resource, 30*time.Second); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable resource %s: %v", resource, err)
}
})

podName := strings.TrimSuffix(filepath.Base(yaml), filepath.Ext(yaml))
ginkgo.It("can run demo app", func() {
runDemoApp("VF", demoVFYaml, f)
})
})
}

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

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

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

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

framework.Logf("log output: %s", log)
}
})
ginkgo.By("getting workload log")

log, err := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, podName, podName)

if err != nil {
framework.Failf("unable to get log from pod: %v", err)
}

framework.Logf("log output: %s", log)
}
114 changes: 62 additions & 52 deletions test/e2e/dsa/dsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,65 +60,75 @@ func describe() {
framework.Failf("unable to locate %q: %v", demoYaml, err)
}

ginkgo.It("runs DSA plugin and a demo workload", func() {
ginkgo.By("deploying DSA plugin")
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "intel-dsa-config", "--from-file="+configmap)

e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))

ginkgo.By("waiting for DSA plugin's availability")
podList, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, f.Namespace.Name,
labels.Set{"app": "intel-dsa-plugin"}.AsSelector(), 1 /* one replica */, 300*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 DSA plugin's securityContext")
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, "dsa.intel.com/wq-user-dedicated", 300*time.Second); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
}

e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", demoPath)

ginkgo.By("waiting for the DSA demo to succeed")
e2epod.NewPodClient(f).WaitForSuccess(podName, 200*time.Second)

ginkgo.By("getting workload log")
log, err := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, podName, podName)

if err != nil {
framework.Failf("unable to get log from pod: %v", err)
}

framework.Logf("log output: %s", log)
ginkgo.Describe("Without using operator", func() {
ginkgo.BeforeEach(func() {
ginkgo.By("deploying DSA plugin")
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "intel-dsa-config", "--from-file="+configmap)

e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))

ginkgo.By("waiting for DSA plugin's availability")
podList, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, f.Namespace.Name,
labels.Set{"app": "intel-dsa-plugin"}.AsSelector(), 1 /* one replica */, 300*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 DSA plugin's securityContext")
if err = utils.TestPodsFileSystemInfo(podList.Items); err != nil {
framework.Failf("container filesystem info checks failed: %v", err)
}
})

ginkgo.Context("When DSA resources are available", func() {
ginkgo.BeforeEach(func() {
ginkgo.By("checking if the resource is allocatable")
if err := utils.WaitForNodesWithResource(f.ClientSet, "dsa.intel.com/wq-user-dedicated", 300*time.Second); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
}
})

ginkgo.It("deploys a demo app", func() {
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", demoPath)

ginkgo.By("waiting for the DSA demo to succeed")
e2epod.NewPodClient(f).WaitForSuccess(podName, 200*time.Second)

ginkgo.By("getting workload log")
log, err := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, podName, podName)

if err != nil {
framework.Failf("unable to get log from pod: %v", err)
}

framework.Logf("log output: %s", log)
})
})
})

ginkgo.It("deploys DSA plugin with operator", func() {
utils.Kubectl("", "apply", "-k", "deployments/operator/default/kustomization.yaml")
ginkgo.Describe("With using operator", func() {
ginkgo.It("deploys DSA plugin with operator", func() {
utils.Kubectl("", "apply", "-k", "deployments/operator/default/kustomization.yaml")

if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"control-plane": "controller-manager"}.AsSelector(), 1, timeout); err != nil {
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}
if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"control-plane": "controller-manager"}.AsSelector(), 1, timeout); err != nil {
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}

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

if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"app": "intel-dsa-plugin"}.AsSelector(), 1, timeout); err != nil {
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}
if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"app": "intel-dsa-plugin"}.AsSelector(), 1, timeout); err != nil {
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}

if err := utils.WaitForNodesWithResource(f.ClientSet, "dsa.intel.com/wq-user-dedicated", timeout); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
}
if err := utils.WaitForNodesWithResource(f.ClientSet, "dsa.intel.com/wq-user-dedicated", timeout); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
}

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

utils.Kubectl("", "delete", "-k", "deployments/operator/default/kustomization.yaml")
utils.Kubectl("", "delete", "-k", "deployments/operator/default/kustomization.yaml")
})
})
}
114 changes: 62 additions & 52 deletions test/e2e/iaa/iaa.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,65 +60,75 @@ func describe() {
framework.Failf("unable to locate %q: %v", demoYaml, err)
}

ginkgo.It("runs IAA plugin and a demo workload", func() {
ginkgo.By("deploying IAA plugin")
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "intel-iaa-config", "--from-file="+configmap)

e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))

ginkgo.By("waiting for IAA plugin's availability")
podList, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, f.Namespace.Name,
labels.Set{"app": "intel-iaa-plugin"}.AsSelector(), 1 /* one replica */, 300*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 IAA plugin's securityContext")
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, "iaa.intel.com/wq-user-dedicated", 300*time.Second); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
}

e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", demoPath)

ginkgo.By("waiting for the IAA demo to succeed")
e2epod.NewPodClient(f).WaitForSuccess(podName, 300*time.Second)

ginkgo.By("getting workload log")
log, err := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, podName, podName)

if err != nil {
framework.Failf("unable to get log from pod: %v", err)
}

framework.Logf("log output: %s", log)
ginkgo.Describe("Without using operator", func() {
ginkgo.BeforeEach(func() {
ginkgo.By("deploying IAA plugin")
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "intel-iaa-config", "--from-file="+configmap)

e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))

ginkgo.By("waiting for IAA plugin's availability")
podList, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, f.Namespace.Name,
labels.Set{"app": "intel-iaa-plugin"}.AsSelector(), 1 /* one replica */, 300*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 IAA plugin's securityContext")
if err = utils.TestPodsFileSystemInfo(podList.Items); err != nil {
framework.Failf("container filesystem info checks failed: %v", err)
}
})

ginkgo.Context("When IAA resources are available", func() {
ginkgo.BeforeEach(func() {
ginkgo.By("checking if the resource is allocatable")
if err := utils.WaitForNodesWithResource(f.ClientSet, "iaa.intel.com/wq-user-dedicated", 300*time.Second); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
}
})

ginkgo.It("deploys a demo app", func() {
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", demoPath)

ginkgo.By("waiting for the IAA demo to succeed")
e2epod.NewPodClient(f).WaitForSuccess(podName, 300*time.Second)

ginkgo.By("getting workload log")
log, err := e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, podName, podName)

if err != nil {
framework.Failf("unable to get log from pod: %v", err)
}

framework.Logf("log output: %s", log)
})
})
})

ginkgo.It("deploys IAA plugin with operator", func() {
utils.Kubectl("", "apply", "-k", "deployments/operator/default/kustomization.yaml")
ginkgo.Describe("With using operator", func() {
ginkgo.It("deploys IAA plugin with operator", func() {
utils.Kubectl("", "apply", "-k", "deployments/operator/default/kustomization.yaml")

if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"control-plane": "controller-manager"}.AsSelector(), 1, timeout); err != nil {
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}
if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"control-plane": "controller-manager"}.AsSelector(), 1, timeout); err != nil {
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}

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

if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"app": "intel-iaa-plugin"}.AsSelector(), 1, timeout); err != nil {
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}
if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"app": "intel-iaa-plugin"}.AsSelector(), 1, timeout); err != nil {
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}

if err := utils.WaitForNodesWithResource(f.ClientSet, "iaa.intel.com/wq-user-dedicated", timeout); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
}
if err := utils.WaitForNodesWithResource(f.ClientSet, "iaa.intel.com/wq-user-dedicated", timeout); err != nil {
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
}

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

utils.Kubectl("", "delete", "-k", "deployments/operator/default/kustomization.yaml")
utils.Kubectl("", "delete", "-k", "deployments/operator/default/kustomization.yaml")
})
})
}
42 changes: 25 additions & 17 deletions test/e2e/qat/qatplugin_dpdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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.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("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.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.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.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)
})
})
}
Loading