Skip to content

Commit

Permalink
Merge pull request #1221 from fmuyassarov/crs-cleanup
Browse files Browse the repository at this point in the history
e2e: delete CRs only if found
  • Loading branch information
k8s-ci-robot authored May 9, 2023
2 parents ef92b2f + cfb8530 commit 50caa92
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/e2e/node_feature_discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,23 @@ func cleanupCRs(ctx context.Context, cli *nfdclient.Clientset, namespace string)
nfrs, err := cli.NfdV1alpha1().NodeFeatureRules().List(ctx, metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred())

By("Deleting NodeFeatureRule objects from the cluster")
for _, nfr := range nfrs.Items {
err = cli.NfdV1alpha1().NodeFeatureRules().Delete(ctx, nfr.Name, metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())
if len(nfrs.Items) != 0 {
By("Deleting NodeFeatureRule objects from the cluster")
for _, nfr := range nfrs.Items {
err = cli.NfdV1alpha1().NodeFeatureRules().Delete(ctx, nfr.Name, metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())
}
}

nfs, err := cli.NfdV1alpha1().NodeFeatures(namespace).List(ctx, metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred())

By("Deleting NodeFeature objects from namespace " + namespace)
for _, nf := range nfs.Items {
err = cli.NfdV1alpha1().NodeFeatures(namespace).Delete(ctx, nf.Name, metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())
if len(nfs.Items) != 0 {
By("Deleting NodeFeature objects from namespace " + namespace)
for _, nf := range nfs.Items {
err = cli.NfdV1alpha1().NodeFeatures(namespace).Delete(ctx, nf.Name, metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())
}
}
}

Expand Down

0 comments on commit 50caa92

Please sign in to comment.