NVIDIA / k8s-device-plugin

NVIDIA device plugin for Kubernetes
Apache License 2.0
2.45k stars 573 forks source link

Fix e2e tests #642

Closed elezar closed 1 month ago

elezar commented 1 month ago

The e2e tests fail (see https://github.com/NVIDIA/k8s-device-plugin/actions/runs/8660409546/job/23748292556) with the following shown:

FAILED] Unexpected error:
      <*errors.StatusError | 0xc0000cc8c0>: 
      nodefeatures.nfd.k8s-sigs.io "holodeck" not found
      {
          ErrStatus: {
              TypeMeta: {Kind: "", APIVersion: ""},
              ListMeta: {
                  SelfLink: "",
                  ResourceVersion: "",
                  Continue: "",
                  RemainingItemCount: nil,
              },
              Status: "Failure",
              Message: "nodefeatures.nfd.k8s-sigs.io \"holodeck\" not found",
              Reason: "NotFound",
              Details: {
                  Name: "holodeck",
                  Group: "nfd.k8s-sigs.io",
                  Kind: "nodefeatures",
                  UID: "",
                  Causes: nil,
                  RetryAfterSeconds: 0,
              },
              Code: 404,
          },
      }
  occurred
  In [AfterEach] at: /home/runner/work/k8s-device-plugin/k8s-device-plugin/tests/e2e/common/kubernetes.go:187 @ 04/12/24 10:15:04.46

This happens when trying to delete the nfd namespace, but it is aready found to not exist. I believe the check needs to be updated to include logic such as https://github.com/kubernetes-sigs/node-feature-discovery/blob/624c02e1e2b5a4340b4921ebc04dd751c200f452/pkg/nfd-gc/nfd-gc.go#L79-L90

Something like (although I must admit that I don't know what the equivalent Gomega expressions are):

diff --git a/tests/e2e/common/kubernetes.go b/tests/e2e/common/kubernetes.go
index a30c763f..71c634ea 100644
--- a/tests/e2e/common/kubernetes.go
+++ b/tests/e2e/common/kubernetes.go
@@ -174,7 +174,7 @@ func CleanupNodeFeatureRules(ctx context.Context, cli *nfdclient.Clientset, name
        By("Deleting NodeFeatureRule objects from the cluster")
        for _, nfr := range nfrs.Items {
            err = cli.NfdV1alpha1().NodeFeatureRules().Delete(ctx, nfr.Name, metav1.DeleteOptions{})
-           Expect(err).Or(NotTo(HaveOccurred()), MatchError(errors.New("not found"))))
+           Expect(err).Or(NotTo(HaveOccurred()), MatchError(errors.New("not found")))
        }
    }

@@ -185,7 +185,7 @@ func CleanupNodeFeatureRules(ctx context.Context, cli *nfdclient.Clientset, name
        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).Or(NotTo(HaveOccurred()), MatchError(errors.New("not found"))))
+           Expect(err).Or(NotTo(HaveOccurred()), MatchError(errors.New("not found")))
        }
    }
 }
ArangoGutierrez commented 1 month ago

in progress