Skip to content

Commit

Permalink
Merge pull request #6992 from nojnhuh/azure-e2e-test
Browse files Browse the repository at this point in the history
Update Azure cluster-autoscaler e2e test
  • Loading branch information
k8s-ci-robot authored Jul 1, 2024
2 parents 3c6dd26 + 999dc87 commit 965c84a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
1 change: 1 addition & 0 deletions cluster-autoscaler/cloudprovider/azure/test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_artifacts
4 changes: 3 additions & 1 deletion cluster-autoscaler/cloudprovider/azure/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ install-e2e: $(HELM)
--set extraArgs.skip-nodes-with-local-storage=false \
--wait

ARTIFACTS?=_artifacts

.PHONY: test-e2e
test-e2e: install-e2e
go run github.com/onsi/ginkgo/v2/ginkgo e2e -v -- \
go run github.com/onsi/ginkgo/v2/ginkgo -v --trace --output-dir "$(ARTIFACTS)" --junit-report="junit.e2e_suite.1.xml" e2e -- \
-resource-group="$$(KUBECONFIG= kubectl get managedclusters -o jsonpath='{.items[0].status.nodeResourceGroup}')"
28 changes: 13 additions & 15 deletions cluster-autoscaler/cloudprovider/azure/test/e2e/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ var _ = Describe("Azure Provider", func() {
Expect(k8s.Delete(ctx, namespace)).To(Succeed())
Eventually(func() bool {
err := k8s.Get(ctx, client.ObjectKeyFromObject(namespace), &corev1.Namespace{})
GinkgoLogr.Info("got err", "error", err)
return apierrors.IsNotFound(err)
}, "1m", "5s").Should(BeTrue(), "Namespace "+namespace.Name+" still exists")
})
Expand Down Expand Up @@ -123,21 +122,20 @@ var _ = Describe("Azure Provider", func() {
Expect(k8s.Delete(ctx, deploy)).To(Succeed())

By("Waiting for the original number of Nodes to be Ready")
Eventually(func() (int, error) {
readyCount := 0
Eventually(func(g Gomega) {
nodes := &corev1.NodeList{}
if err := k8s.List(ctx, nodes); err != nil {
return 0, err
}
for _, node := range nodes.Items {
for _, cond := range node.Status.Conditions {
if cond.Type == corev1.NodeReady && cond.Status == corev1.ConditionTrue {
readyCount++
break
g.Expect(k8s.List(ctx, nodes)).To(Succeed())
g.Expect(nodes.Items).To(SatisfyAll(
HaveLen(nodeCountBefore),
ContainElements(Satisfy(func(node corev1.Node) bool {
for _, cond := range node.Status.Conditions {
if cond.Type == corev1.NodeReady && cond.Status == corev1.ConditionTrue {
return true
}
}
}
}
return readyCount, nil
}, "10m", "10s").Should(Equal(nodeCountBefore))
return false
})),
))
}, "20m", "10s").Should(Succeed())
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,12 @@ func allVMSSStable(g Gomega) {
g.Expect(nodes.Items).To(SatisfyAll(
HaveLen(int(expectedNodes)),
ContainElements(Satisfy(func(node corev1.Node) bool {
ready := false
for _, cond := range node.Status.Conditions {
if cond.Type == corev1.NodeReady && cond.Status == corev1.ConditionTrue {
ready = true
break
return true
}
}
return ready
return false
})),
))
}

0 comments on commit 965c84a

Please sign in to comment.