From aa21d7a71822249f35a97b974fbf895c5c597954 Mon Sep 17 00:00:00 2001 From: Jim Minter Date: Thu, 12 Nov 2020 13:20:50 -0600 Subject: [PATCH] for now, make e2es tolerant to kubernetes api blips --- test/e2e/adminapi_kubernetesobjects.go | 20 ++++++++++---------- test/e2e/adminapi_redeployvm.go | 3 ++- test/e2e/operator.go | 19 ++++++++++++++++--- test/e2e/scalenodes.go | 6 ++++-- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/test/e2e/adminapi_kubernetesobjects.go b/test/e2e/adminapi_kubernetesobjects.go index f6f2725da..b51d0c76c 100644 --- a/test/e2e/adminapi_kubernetesobjects.go +++ b/test/e2e/adminapi_kubernetesobjects.go @@ -71,13 +71,13 @@ var _ = Describe("[Admin API] Kubernetes objects action", func() { By("waiting for the test customer namespace to be deleted") err = wait.PollImmediate(10*time.Second, 5*time.Minute, func() (bool, error) { _, err := clients.Kubernetes.CoreV1().Namespaces().Get(context.Background(), namespace, metav1.GetOptions{}) - if err == nil { - return false, nil + if errors.IsNotFound(err) { + return true, nil } - if !errors.IsNotFound(err) { - return false, err + if err != nil { + log.Warn(err) } - return true, nil + return false, nil // swallow error }) Expect(err).NotTo(HaveOccurred()) }() @@ -244,13 +244,13 @@ func testConfigMapDeleteOK(objName, namespace string) { By("waiting for the configmap to be deleted") err = wait.PollImmediate(10*time.Second, time.Minute, func() (bool, error) { _, err = clients.Kubernetes.CoreV1().ConfigMaps(namespace).Get(context.Background(), objName, metav1.GetOptions{}) - if err == nil { - return false, nil + if errors.IsNotFound(err) { + return true, nil } - if !errors.IsNotFound(err) { - return false, err + if err != nil { + log.Warn(err) } - return true, nil + return false, nil // swallow error }) Expect(err).NotTo(HaveOccurred()) } diff --git a/test/e2e/adminapi_redeployvm.go b/test/e2e/adminapi_redeployvm.go index 80b30f6e1..1d49b4b03 100644 --- a/test/e2e/adminapi_redeployvm.go +++ b/test/e2e/adminapi_redeployvm.go @@ -73,7 +73,8 @@ var _ = Describe("[Admin API] VM redeploy action", func() { err = wait.PollImmediate(10*time.Second, 10*time.Minute, func() (bool, error) { nodes, err := clients.Kubernetes.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) if err != nil { - return false, err + log.Warn(err) + return false, nil // swallow error } for _, node := range nodes.Items { diff --git a/test/e2e/operator.go b/test/e2e/operator.go index 09a0ff609..0c71c8da1 100644 --- a/test/e2e/operator.go +++ b/test/e2e/operator.go @@ -104,7 +104,8 @@ var _ = Describe("ARO Operator - Internet checking", func() { err = wait.PollImmediate(10*time.Second, 10*time.Minute, func() (bool, error) { co, err := clients.AROClusters.Clusters().Get(context.Background(), "cluster", metav1.GetOptions{}) if err != nil { - return false, err + log.Warn(err) + return false, nil // swallow error } log.Debugf("ClusterStatus.Conditions %s", co.Status.Conditions) @@ -117,7 +118,13 @@ var _ = Describe("ARO Operator - Internet checking", func() { var _ = Describe("ARO Operator - Geneva Logging", func() { Specify("genevalogging must be repaired if deployment deleted", func() { - mdsdReady := ready.CheckDaemonSetIsReady(context.Background(), clients.Kubernetes.AppsV1().DaemonSets("openshift-azure-logging"), "mdsd") + mdsdReady := func() (bool, error) { + done, err := ready.CheckDaemonSetIsReady(context.Background(), clients.Kubernetes.AppsV1().DaemonSets("openshift-azure-logging"), "mdsd")() + if err != nil { + log.Warn(err) + } + return done, nil // swallow error + } err := wait.PollImmediate(30*time.Second, 15*time.Minute, mdsdReady) Expect(err).NotTo(HaveOccurred()) @@ -149,7 +156,13 @@ var _ = Describe("ARO Operator - Routefix Daemonset", func() { BeforeEach(skipIfNotInDevelopmentEnv) Specify("routefix must be repaired if daemonset is deleted", func() { - dsReady := ready.CheckDaemonSetIsReady(context.Background(), clients.Kubernetes.AppsV1().DaemonSets("openshift-azure-routefix"), "routefix") + dsReady := func() (bool, error) { + done, err := ready.CheckDaemonSetIsReady(context.Background(), clients.Kubernetes.AppsV1().DaemonSets("openshift-azure-routefix"), "routefix")() + if err != nil { + log.Warn(err) + } + return done, nil // swallow error + } err := wait.PollImmediate(30*time.Second, 15*time.Minute, dsReady) Expect(err).NotTo(HaveOccurred()) diff --git a/test/e2e/scalenodes.go b/test/e2e/scalenodes.go index 069fe266f..fb55d7cd0 100644 --- a/test/e2e/scalenodes.go +++ b/test/e2e/scalenodes.go @@ -38,7 +38,8 @@ var _ = Describe("Scale nodes", func() { err = wait.PollImmediate(10*time.Second, 30*time.Minute, func() (bool, error) { nodes, err := clients.Kubernetes.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{}) if err != nil { - return false, err + log.Warn(err) + return false, nil // swallow error } var nodeCount int @@ -97,7 +98,8 @@ func waitForScale(name string) error { return wait.PollImmediate(10*time.Second, 30*time.Minute, func() (bool, error) { ms, err := clients.MachineAPI.MachineV1beta1().MachineSets("openshift-machine-api").Get(context.Background(), name, metav1.GetOptions{}) if err != nil { - return false, err + log.Warn(err) + return false, nil // swallow error } if ms.Spec.Replicas == nil {