diff --git a/cluster-autoscaler/cloudprovider/azure/test/.gitignore b/cluster-autoscaler/cloudprovider/azure/test/.gitignore new file mode 100644 index 000000000000..9c2b30a747bf --- /dev/null +++ b/cluster-autoscaler/cloudprovider/azure/test/.gitignore @@ -0,0 +1 @@ +_artifacts diff --git a/cluster-autoscaler/cloudprovider/azure/test/Makefile b/cluster-autoscaler/cloudprovider/azure/test/Makefile index 979fea3f5082..c5f117714b24 100644 --- a/cluster-autoscaler/cloudprovider/azure/test/Makefile +++ b/cluster-autoscaler/cloudprovider/azure/test/Makefile @@ -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}')" diff --git a/cluster-autoscaler/cloudprovider/azure/test/e2e/azure_test.go b/cluster-autoscaler/cloudprovider/azure/test/e2e/azure_test.go index 51938a4dcd10..6129570f1f73 100644 --- a/cluster-autoscaler/cloudprovider/azure/test/e2e/azure_test.go +++ b/cluster-autoscaler/cloudprovider/azure/test/e2e/azure_test.go @@ -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") }) @@ -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()) }) }) diff --git a/cluster-autoscaler/cloudprovider/azure/test/e2e/e2e_suite_test.go b/cluster-autoscaler/cloudprovider/azure/test/e2e/e2e_suite_test.go index 03aa817b844d..50c649737387 100644 --- a/cluster-autoscaler/cloudprovider/azure/test/e2e/e2e_suite_test.go +++ b/cluster-autoscaler/cloudprovider/azure/test/e2e/e2e_suite_test.go @@ -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 })), )) }