diff --git a/test/pkg/environment/common/expectations.go b/test/pkg/environment/common/expectations.go index b691ab81a959..3dc649e105ff 100644 --- a/test/pkg/environment/common/expectations.go +++ b/test/pkg/environment/common/expectations.go @@ -482,49 +482,26 @@ func (env *Environment) ConsistentlyExpectMachineCount(comparator string, count return lo.ToSlicePtr(machineList.Items) } -func (env *Environment) EventuallyExpectCordonedNodeCountLegacy(comparator string, count int) []*v1.Node { +func (env *Environment) EventuallyExpectTaintedNodeCount(comparator string, count int) []*v1.Node { GinkgoHelper() - By(fmt.Sprintf("waiting for cordoned nodes to be %s to %d", comparator, count)) - nodeList := &v1.NodeList{} - Eventually(func(g Gomega) { - g.Expect(env.Client.List(env, nodeList, client.MatchingFields{"spec.unschedulable": "true"})).To(Succeed()) - g.Expect(len(nodeList.Items)).To(BeNumerically(comparator, count), - fmt.Sprintf("expected %d cordoned nodes, had %d (%v)", count, len(nodeList.Items), NodeNames(lo.ToSlicePtr(nodeList.Items)))) - }).Should(Succeed()) - return lo.ToSlicePtr(nodeList.Items) -} - -func (env *Environment) EventuallyExpectNodesUncordonedLegacyWithTimeout(timeout time.Duration, nodes ...*v1.Node) { - GinkgoHelper() - By(fmt.Sprintf("waiting for %d nodes to be uncordoned", len(nodes))) - nodeList := &v1.NodeList{} - Eventually(func(g Gomega) { - g.Expect(env.Client.List(env, nodeList, client.MatchingFields{"spec.unschedulable": "true"})).To(Succeed()) - cordonedNodeNames := lo.Map(nodeList.Items, func(n v1.Node, _ int) string { return n.Name }) - g.Expect(cordonedNodeNames).ToNot(ContainElements(lo.Map(nodes, func(n *v1.Node, _ int) interface{} { return n.Name })...)) - }).WithTimeout(timeout).Should(Succeed()) -} - -func (env *Environment) EventuallyExpectCordonedNodeCount(comparator string, count int) []*v1.Node { - GinkgoHelper() - By(fmt.Sprintf("waiting for cordoned nodes to be %s to %d", comparator, count)) + By(fmt.Sprintf("waiting for tainted nodes to be %s to %d", comparator, count)) nodeList := &v1.NodeList{} Eventually(func(g Gomega) { g.Expect(env.Client.List(env, nodeList, client.MatchingFields{"spec.taints[*].karpenter.sh/disruption": "disrupting"})).To(Succeed()) g.Expect(len(nodeList.Items)).To(BeNumerically(comparator, count), - fmt.Sprintf("expected %d cordoned nodes, had %d (%v)", count, len(nodeList.Items), NodeNames(lo.ToSlicePtr(nodeList.Items)))) + fmt.Sprintf("expected %d tainted nodes, had %d (%v)", count, len(nodeList.Items), NodeNames(lo.ToSlicePtr(nodeList.Items)))) }).Should(Succeed()) return lo.ToSlicePtr(nodeList.Items) } -func (env *Environment) EventuallyExpectNodesUncordonedWithTimeout(timeout time.Duration, nodes ...*v1.Node) { +func (env *Environment) EventuallyExpectNodesUntaintedWithTimeout(timeout time.Duration, nodes ...*v1.Node) { GinkgoHelper() - By(fmt.Sprintf("waiting for %d nodes to be uncordoned", len(nodes))) + By(fmt.Sprintf("waiting for %d nodes to be untainted", len(nodes))) nodeList := &v1.NodeList{} Eventually(func(g Gomega) { g.Expect(env.Client.List(env, nodeList, client.MatchingFields{"spec.taints[*].karpenter.sh/disruption": "disrupting"})).To(Succeed()) - cordonedNodeNames := lo.Map(nodeList.Items, func(n v1.Node, _ int) string { return n.Name }) - g.Expect(cordonedNodeNames).ToNot(ContainElements(lo.Map(nodes, func(n *v1.Node, _ int) interface{} { return n.Name })...)) + taintedNodeNames := lo.Map(nodeList.Items, func(n v1.Node, _ int) string { return n.Name }) + g.Expect(taintedNodeNames).ToNot(ContainElements(lo.Map(nodes, func(n *v1.Node, _ int) interface{} { return n.Name })...)) }).WithTimeout(timeout).Should(Succeed()) } diff --git a/test/suites/drift/suite_test.go b/test/suites/drift/suite_test.go index 6e4d9f3dffca..b9d7a7edf49d 100644 --- a/test/suites/drift/suite_test.go +++ b/test/suites/drift/suite_test.go @@ -431,12 +431,12 @@ var _ = Describe("Beta/Drift", Label("AWS"), func() { } }).Should(Succeed()) - // Expect nodes To get cordoned - cordonedNodes := env.EventuallyExpectCordonedNodeCount("==", 1) + // Expect nodes To get tainted + taintedNodes := env.EventuallyExpectTaintedNodeCount("==", 1) - // Drift should fail and the original node should be uncordoned + // Drift should fail and the original node should be untainted // TODO: reduce timeouts when disruption waits are factored out - env.EventuallyExpectNodesUncordonedWithTimeout(11*time.Minute, cordonedNodes...) + env.EventuallyExpectNodesUntaintedWithTimeout(11*time.Minute, taintedNodes...) // We give another 6 minutes here to handle the deletion at the 15m registration timeout Eventually(func(g Gomega) { @@ -487,12 +487,12 @@ var _ = Describe("Beta/Drift", Label("AWS"), func() { } }).Should(Succeed()) - // Expect nodes To be cordoned - cordonedNodes := env.EventuallyExpectCordonedNodeCount("==", 1) + // Expect nodes to be tainted + taintedNodes := env.EventuallyExpectTaintedNodeCount("==", 1) - // Drift should fail and original node should be uncordoned + // Drift should fail and original node should be untainted // TODO: reduce timeouts when disruption waits are factored out - env.EventuallyExpectNodesUncordonedWithTimeout(11*time.Minute, cordonedNodes...) + env.EventuallyExpectNodesUntaintedWithTimeout(11*time.Minute, taintedNodes...) // Expect that the new nodeClaim/node is kept around after the un-cordon nodeList := &v1.NodeList{} diff --git a/test/suites/expiration/suite_test.go b/test/suites/expiration/suite_test.go index f47fcbf57dbb..8f849f76fa8e 100644 --- a/test/suites/expiration/suite_test.go +++ b/test/suites/expiration/suite_test.go @@ -229,12 +229,12 @@ var _ = Describe("Expiration", func() { } }).Should(Succeed()) - // Expect nodes To get cordoned - cordonedNodes := env.EventuallyExpectCordonedNodeCount("==", 1) + // Expect nodes To get tainted + taintedNodes := env.EventuallyExpectTaintedNodeCount("==", 1) - // Expire should fail and the original node should be uncordoned + // Expire should fail and the original node should be untainted // TODO: reduce timeouts when deprovisioning waits are factored out - env.EventuallyExpectNodesUncordonedWithTimeout(11*time.Minute, cordonedNodes...) + env.EventuallyExpectNodesUntaintedWithTimeout(11*time.Minute, taintedNodes...) // The nodeclaims that never registers will be removed Eventually(func(g Gomega) { @@ -294,12 +294,12 @@ var _ = Describe("Expiration", func() { } }).Should(Succeed()) - // Expect nodes To be cordoned - cordonedNodes := env.EventuallyExpectCordonedNodeCount("==", 1) + // Expect nodes To be tainted + taintedNodes := env.EventuallyExpectTaintedNodeCount("==", 1) - // Expire should fail and original node should be uncordoned and no NodeClaims should be removed + // Expire should fail and original node should be untainted and no NodeClaims should be removed // TODO: reduce timeouts when deprovisioning waits are factored out - env.EventuallyExpectNodesUncordonedWithTimeout(11*time.Minute, cordonedNodes...) + env.EventuallyExpectNodesUntaintedWithTimeout(11*time.Minute, taintedNodes...) // Expect that the new NodeClaim/Node is kept around after the un-cordon nodeList := &v1.NodeList{}