Skip to content
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

test/e2e: refactor setup and cleanup #847

Merged
merged 1 commit into from
Aug 9, 2022
Merged
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
22 changes: 5 additions & 17 deletions test/e2e/node_feature_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
err := testutils.ConfigureRBAC(f.ClientSet, f.Namespace.Name)
Expect(err).NotTo(HaveOccurred())

// Remove pre-existing stale annotations and labels
cleanupNode(f.ClientSet)

// Launch nfd-master
By("Creating nfd master pod and nfd-master service")
image := fmt.Sprintf("%s:%s", *dockerRepo, *dockerTag)
Expand All @@ -130,9 +133,9 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
})

AfterEach(func() {
err := testutils.DeconfigureRBAC(f.ClientSet, f.Namespace.Name)
Expect(err).NotTo(HaveOccurred())
Expect(testutils.DeconfigureRBAC(f.ClientSet, f.Namespace.Name)).NotTo(HaveOccurred())

cleanupNode(f.ClientSet)
})

//
Expand All @@ -147,9 +150,6 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
master.FeatureLabelNs + "/fake-fakefeature3": "true",
}

// Remove pre-existing stale annotations and labels
cleanupNode(f.ClientSet)

// Launch nfd-worker
By("Creating a nfd worker pod")
image := fmt.Sprintf("%s:%s", *dockerRepo, *dockerTag)
Expand Down Expand Up @@ -179,8 +179,6 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
By("Deleting the node-feature-discovery worker pod")
err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), workerPod.ObjectMeta.Name, metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())

cleanupNode(f.ClientSet)
})
})

Expand All @@ -200,9 +198,6 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
}
fConf := cfg.DefaultFeatures

// Remove pre-existing stale annotations and labels
cleanupNode(f.ClientSet)

By("Creating nfd-worker daemonset")
workerDS := testutils.NFDWorkerDaemonSet(fmt.Sprintf("%s:%s", *dockerRepo, *dockerTag), []string{})
workerDS, err = f.ClientSet.AppsV1().DaemonSets(f.Namespace.Name).Create(context.TODO(), workerDS, metav1.CreateOptions{})
Expand Down Expand Up @@ -269,8 +264,6 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
By("Deleting nfd-worker daemonset")
err = f.ClientSet.AppsV1().DaemonSets(f.Namespace.Name).Delete(context.TODO(), workerDS.ObjectMeta.Name, metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())

cleanupNode(f.ClientSet)
})
})

Expand All @@ -279,9 +272,6 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
//
Context("and nfd-workers as a daemonset with 2 additional configmaps for the custom source configured", func() {
It("the nodename matching features listed in the configmaps should be present", func() {
// Remove pre-existing stale annotations and labels
cleanupNode(f.ClientSet)

By("Getting a worker node")

// We need a valid nodename for the configmap
Expand Down Expand Up @@ -426,8 +416,6 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
By("Deleting nfd-worker daemonset")
err = f.ClientSet.AppsV1().DaemonSets(f.Namespace.Name).Delete(context.TODO(), workerDS.ObjectMeta.Name, metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())

cleanupNode(f.ClientSet)
})
})

Expand Down