Skip to content

Commit 766b25f

Browse files
e2e: remove the unncessary layer 'ginkgo.Describe' for dsa & iaa
Signed-off-by: Hyeongju Johannes Lee <[email protected]>
1 parent 6861ef5 commit 766b25f

File tree

2 files changed

+78
-82
lines changed

2 files changed

+78
-82
lines changed

test/e2e/dsa/dsa.go

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -64,52 +64,50 @@ func describe() {
6464

6565
var dpPodName string
6666

67-
ginkgo.Describe("Without using operator", func() {
68-
ginkgo.BeforeEach(func(ctx context.Context) {
69-
ginkgo.By("deploying DSA plugin")
70-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "intel-dsa-config", "--from-file="+configmap)
71-
72-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
73-
74-
ginkgo.By("waiting for DSA plugin's availability")
75-
podList, err := e2epod.WaitForPodsWithLabelRunningReady(ctx, f.ClientSet, f.Namespace.Name,
76-
labels.Set{"app": "intel-dsa-plugin"}.AsSelector(), 1 /* one replica */, 300*time.Second)
77-
if err != nil {
78-
e2edebug.DumpAllNamespaceInfo(ctx, f.ClientSet, f.Namespace.Name)
79-
e2ekubectl.LogFailedContainers(ctx, f.ClientSet, f.Namespace.Name, framework.Logf)
80-
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
81-
}
82-
dpPodName = podList.Items[0].Name
67+
ginkgo.BeforeEach(func(ctx context.Context) {
68+
ginkgo.By("deploying DSA plugin")
69+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "intel-dsa-config", "--from-file="+configmap)
70+
71+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
72+
73+
ginkgo.By("waiting for DSA plugin's availability")
74+
podList, err := e2epod.WaitForPodsWithLabelRunningReady(ctx, f.ClientSet, f.Namespace.Name,
75+
labels.Set{"app": "intel-dsa-plugin"}.AsSelector(), 1 /* one replica */, 300*time.Second)
76+
if err != nil {
77+
e2edebug.DumpAllNamespaceInfo(ctx, f.ClientSet, f.Namespace.Name)
78+
e2ekubectl.LogFailedContainers(ctx, f.ClientSet, f.Namespace.Name, framework.Logf)
79+
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
80+
}
81+
dpPodName = podList.Items[0].Name
82+
83+
ginkgo.By("checking DSA plugin's securityContext")
84+
if err = utils.TestPodsFileSystemInfo(podList.Items); err != nil {
85+
framework.Failf("container filesystem info checks failed: %v", err)
86+
}
87+
})
8388

84-
ginkgo.By("checking DSA plugin's securityContext")
85-
if err = utils.TestPodsFileSystemInfo(podList.Items); err != nil {
86-
framework.Failf("container filesystem info checks failed: %v", err)
87-
}
88-
})
89+
ginkgo.AfterEach(func(ctx context.Context) {
90+
ginkgo.By("undeploying DSA plugin")
91+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "delete", "-k", filepath.Dir(kustomizationPath))
92+
if err := e2epod.WaitForPodNotFoundInNamespace(ctx, f.ClientSet, dpPodName, f.Namespace.Name, 30*time.Second); err != nil {
93+
framework.Failf("failed to terminate pod: %v", err)
94+
}
95+
})
8996

90-
ginkgo.AfterEach(func(ctx context.Context) {
91-
ginkgo.By("undeploying DSA plugin")
92-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "delete", "-k", filepath.Dir(kustomizationPath))
93-
if err := e2epod.WaitForPodNotFoundInNamespace(ctx, f.ClientSet, dpPodName, f.Namespace.Name, 30*time.Second); err != nil {
94-
framework.Failf("failed to terminate pod: %v", err)
97+
ginkgo.Context("When DSA resources are available", func() {
98+
ginkgo.BeforeEach(func(ctx context.Context) {
99+
ginkgo.By("checking if the resource is allocatable")
100+
if err := utils.WaitForNodesWithResource(ctx, f.ClientSet, "dsa.intel.com/wq-user-dedicated", 300*time.Second); err != nil {
101+
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
95102
}
96103
})
97104

98-
ginkgo.Context("When DSA resources are available", func() {
99-
ginkgo.BeforeEach(func(ctx context.Context) {
100-
ginkgo.By("checking if the resource is allocatable")
101-
if err := utils.WaitForNodesWithResource(ctx, f.ClientSet, "dsa.intel.com/wq-user-dedicated", 300*time.Second); err != nil {
102-
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
103-
}
104-
})
105-
106-
ginkgo.It("deploys a demo app", func(ctx context.Context) {
107-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", demoPath)
108-
109-
ginkgo.By("waiting for the DSA demo to succeed")
110-
err := e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, podName, f.Namespace.Name, 200*time.Second)
111-
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, podName, podName))
112-
})
105+
ginkgo.It("deploys a demo app", func(ctx context.Context) {
106+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", demoPath)
107+
108+
ginkgo.By("waiting for the DSA demo to succeed")
109+
err := e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, podName, f.Namespace.Name, 200*time.Second)
110+
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, podName, podName))
113111
})
114112
})
115113
}

test/e2e/iaa/iaa.go

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -64,52 +64,50 @@ func describe() {
6464

6565
var dpPodName string
6666

67-
ginkgo.Describe("Without using operator", func() {
68-
ginkgo.BeforeEach(func(ctx context.Context) {
69-
ginkgo.By("deploying IAA plugin")
70-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "intel-iaa-config", "--from-file="+configmap)
71-
72-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
73-
74-
ginkgo.By("waiting for IAA plugin's availability")
75-
podList, err := e2epod.WaitForPodsWithLabelRunningReady(ctx, f.ClientSet, f.Namespace.Name,
76-
labels.Set{"app": "intel-iaa-plugin"}.AsSelector(), 1 /* one replica */, 300*time.Second)
77-
if err != nil {
78-
e2edebug.DumpAllNamespaceInfo(ctx, f.ClientSet, f.Namespace.Name)
79-
e2ekubectl.LogFailedContainers(ctx, f.ClientSet, f.Namespace.Name, framework.Logf)
80-
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
81-
}
82-
dpPodName = podList.Items[0].Name
67+
ginkgo.BeforeEach(func(ctx context.Context) {
68+
ginkgo.By("deploying IAA plugin")
69+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "configmap", "intel-iaa-config", "--from-file="+configmap)
70+
71+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(kustomizationPath))
72+
73+
ginkgo.By("waiting for IAA plugin's availability")
74+
podList, err := e2epod.WaitForPodsWithLabelRunningReady(ctx, f.ClientSet, f.Namespace.Name,
75+
labels.Set{"app": "intel-iaa-plugin"}.AsSelector(), 1 /* one replica */, 300*time.Second)
76+
if err != nil {
77+
e2edebug.DumpAllNamespaceInfo(ctx, f.ClientSet, f.Namespace.Name)
78+
e2ekubectl.LogFailedContainers(ctx, f.ClientSet, f.Namespace.Name, framework.Logf)
79+
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
80+
}
81+
dpPodName = podList.Items[0].Name
82+
83+
ginkgo.By("checking IAA plugin's securityContext")
84+
if err = utils.TestPodsFileSystemInfo(podList.Items); err != nil {
85+
framework.Failf("container filesystem info checks failed: %v", err)
86+
}
87+
})
8388

84-
ginkgo.By("checking IAA plugin's securityContext")
85-
if err = utils.TestPodsFileSystemInfo(podList.Items); err != nil {
86-
framework.Failf("container filesystem info checks failed: %v", err)
87-
}
88-
})
89+
ginkgo.AfterEach(func(ctx context.Context) {
90+
ginkgo.By("undeploying IAA plugin")
91+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "delete", "-k", filepath.Dir(kustomizationPath))
92+
if err := e2epod.WaitForPodNotFoundInNamespace(ctx, f.ClientSet, dpPodName, f.Namespace.Name, 30*time.Second); err != nil {
93+
framework.Failf("failed to terminate pod: %v", err)
94+
}
95+
})
8996

90-
ginkgo.AfterEach(func(ctx context.Context) {
91-
ginkgo.By("undeploying IAA plugin")
92-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "delete", "-k", filepath.Dir(kustomizationPath))
93-
if err := e2epod.WaitForPodNotFoundInNamespace(ctx, f.ClientSet, dpPodName, f.Namespace.Name, 30*time.Second); err != nil {
94-
framework.Failf("failed to terminate pod: %v", err)
97+
ginkgo.Context("When IAA resources are available", func() {
98+
ginkgo.BeforeEach(func(ctx context.Context) {
99+
ginkgo.By("checking if the resource is allocatable")
100+
if err := utils.WaitForNodesWithResource(ctx, f.ClientSet, "iaa.intel.com/wq-user-dedicated", 300*time.Second); err != nil {
101+
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
95102
}
96103
})
97104

98-
ginkgo.Context("When IAA resources are available", func() {
99-
ginkgo.BeforeEach(func(ctx context.Context) {
100-
ginkgo.By("checking if the resource is allocatable")
101-
if err := utils.WaitForNodesWithResource(ctx, f.ClientSet, "iaa.intel.com/wq-user-dedicated", 300*time.Second); err != nil {
102-
framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
103-
}
104-
})
105-
106-
ginkgo.It("deploys a demo app", func(ctx context.Context) {
107-
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", demoPath)
108-
109-
ginkgo.By("waiting for the IAA demo to succeed")
110-
err := e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, podName, f.Namespace.Name, 300*time.Second)
111-
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, podName, podName))
112-
})
105+
ginkgo.It("deploys a demo app", func(ctx context.Context) {
106+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", demoPath)
107+
108+
ginkgo.By("waiting for the IAA demo to succeed")
109+
err := e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, podName, f.Namespace.Name, 300*time.Second)
110+
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, podName, podName))
113111
})
114112
})
115113
}

0 commit comments

Comments
 (0)