Skip to content

Commit

Permalink
test/e2e: refactor setup and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
marquiz committed Aug 9, 2022
1 parent d3446b6 commit 190e320
Showing 1 changed file with 5 additions and 17 deletions.
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

0 comments on commit 190e320

Please sign in to comment.