-
Notifications
You must be signed in to change notification settings - Fork 247
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: add basic e2e-tests for NodeFeature API #1001
test/e2e: add basic e2e-tests for NodeFeature API #1001
Conversation
✅ Deploy Preview for kubernetes-sigs-nfd ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: marquiz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @fmuyassarov @ArangoGutierrez |
bf2c08c
to
52ceb4f
Compare
52ceb4f
to
2c8d2fc
Compare
Rebased |
2c8d2fc
to
52ceb4f
Compare
52ceb4f
to
2c8d2fc
Compare
2c8d2fc
to
68ed274
Compare
Preparation for running the same tests with NodeFeature API enabled (instead of gRPC).
68ed274
to
6a8b809
Compare
Yet another rebase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @marquiz. Some inline comments.
err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), workerPod.ObjectMeta.Name, metav1.DeleteOptions{}) | ||
By("Verifying the node where nfd-master is running") | ||
// Get updated masterPod object (we want to know where it was scheduled) | ||
masterPod, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(context.TODO(), masterPod.ObjectMeta.Name, metav1.GetOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
masterPod, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(context.TODO(), masterPod.ObjectMeta.Name, metav1.GetOptions{}) | |
masterPod, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(context.TODO(), masterPod.Name, metav1.GetOptions{}) |
nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx! A bit unrelated to this PR as the first patch basically just indents the code by one tab (creating a function wrapper). All these ObjectMeta fixed separately in #1005
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, thanks
} | ||
fConf := cfg.DefaultFeatures | ||
By("Waiting for the nfd-master service to be up") | ||
Expect(e2enetwork.WaitForService(f.ClientSet, f.Namespace.Name, nfdSvc.ObjectMeta.Name, true, time.Second, 10*time.Second)).NotTo(HaveOccurred()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expect(e2enetwork.WaitForService(f.ClientSet, f.Namespace.Name, nfdSvc.ObjectMeta.Name, true, time.Second, 10*time.Second)).NotTo(HaveOccurred()) | |
Expect(e2enetwork.WaitForService(f.ClientSet, f.Namespace.Name, nfdSvc.Name, true, time.Second, 10*time.Second)).NotTo(HaveOccurred()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1005
checkNodeFeatureObject(workerPod.Spec.NodeName) | ||
|
||
By("Deleting the node-feature-discovery worker pod") | ||
err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), workerPod.ObjectMeta.Name, metav1.DeleteOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), workerPod.ObjectMeta.Name, metav1.DeleteOptions{}) | |
err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), workerPod.Name, metav1.DeleteOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1005
_, err := nfdClient.NfdV1alpha1().NodeFeatures(f.Namespace.Name).Get(context.TODO(), name, metav1.GetOptions{}) | ||
if useNodeFeatureApi { | ||
By(fmt.Sprintf("Check that NodeFeature object for the node %q was created", name)) | ||
Expect(err).NotTo(HaveOccurred()) | ||
} else { | ||
By(fmt.Sprintf("Check that NodeFeature object for the node %q hasn't been created", name)) | ||
Expect(err).To(HaveOccurred()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IINW, NodeFeature CRD will still be applied even though we are using gRPC because its definition is in the same file. I think we should extend the else
statement to check that NodeFeature is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's fine, doesn't do any harm afaics. I mean I think it's ok to create both CRDs even if we run with NodeFeature disabled in the first pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point was, only expecting err to have occurred is not enough, because we might have no error of getting NodeFeature and still get 0 NodeFeature, which is the case that falls under else{}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point was, only expecting err to have occurred is not enough, because we might have no error of getting NodeFeature and still get 0 NodeFeature, which is the case that falls under
else{}
.
Ach, sorry for reading this comment way too hastily. This doesn't create the CRD. It's about nfd-worker creating the NodeFeature object (for the node it's running on). We Get
a NodeFeature object with a specified name in a specified namespace so we get a NotExist error if that does not exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually you are right, I didn't take into account namespace and name...
Add an initial test set for the NodeFeature API. This is done simply by running a second pass of the tests but with -enable-nodefeature-api (i.e. NodeFeature API enabled and gRPC disabled). This should give basic confidence that the API actually works and form a basis for further imporovements on testing the new CRD API.
6a8b809
to
b67d6d7
Compare
Thanks @fmuyassarov for the review. Feedback addressed/responded. WDYT, PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think with this we are close to cut the release soon.
/lgtm
LGTM label has been added. Git tree hash: 5682f49dbfb9e871e6f3dfddf1f8de63eb4bc089
|
👍 |
Add an initial test set for the NodeFeature API. This is done simply by
running a second pass of the tests but with -enable-nodefeature-api
(i.e. NodeFeature API enabled and gRPC disabled). This should give basic
confidence that the API actually works and form a basis for further
imporovements on testing the new CRD API.