Add an integration test for node deletion - #1126
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
thiyyakat
left a comment
There was a problem hiding this comment.
Thanks for the changes! The test looks good to me. I just had a few questions about possible behaviour.
| github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
| github.com/josharian/intern v1.0.0 // indirect | ||
| github.com/json-iterator/go v1.1.12 // indirect | ||
| github.com/kylelemons/godebug v1.1.0 // indirect |
There was a problem hiding this comment.
This dependency gets removed on running go mod tidy like in the other PR.
| ginkgo.By("Waiting until number of ready nodes is 1 more than initial nodes") | ||
| gomega.Eventually( | ||
| c.TargetCluster.GetNumberOfNodes, | ||
| c.timeout, | ||
| c.pollingInterval). | ||
| Should(gomega.BeNumerically("==", initialNodes+1)) | ||
|
|
||
| gomega.Eventually( | ||
| c.TargetCluster.GetNumberOfReadyNodes, | ||
| c.timeout, | ||
| c.pollingInterval). | ||
| Should(gomega.BeNumerically("==", initialNodes+1)) |
There was a problem hiding this comment.
Just out of curiosity, why are there separate Eventually checks for GetNumberOfNodes and GetNumberOfReadyNodes? Does the latter not subsume the first check? I can see it is being done elsewhere too, just wanted to understand rationale.
| gomega.Expect(err).To(gomega.BeNil()) | ||
|
|
||
| ginkgo.By("Deleting node associated with test-machine") | ||
| err = c.TargetCluster.Clientset.CoreV1().Nodes().Delete(ctx, existingMachine.Labels["node"], metav1.DeleteOptions{}) |
There was a problem hiding this comment.
Is there a race condition possible here? existingMachine.Labels["node"] may get set after a node is ready, in which case Delete will fail and leave an orphaned resource. You could avoid this by waiting for the label to get set on the machine before calling delete.
| gomega.Expect(err).To(gomega.BeNil()) | ||
|
|
||
| ginkgo.By("Deleting node associated with test-machine") | ||
| err = c.TargetCluster.Clientset.CoreV1().Nodes().Delete(ctx, existingMachine.Labels["node"], metav1.DeleteOptions{}) |
There was a problem hiding this comment.
| err = c.TargetCluster.Clientset.CoreV1().Nodes().Delete(ctx, existingMachine.Labels["node"], metav1.DeleteOptions{}) | |
| err = c.TargetCluster.Clientset.CoreV1().Nodes().Delete(ctx, existingMachine.Labels[v1alpha1.NodeLabelKey], metav1.DeleteOptions{}) |
What this PR does / why we need it:
This PR add an integration test to verify if machine deletion happens when node deletion is triggered
Which issue(s) this PR fixes:
Fixes partially #1123
Special notes for your reviewer:
Release note: