diff --git a/test/calico/metadata_access_test.go b/test/calico/metadata_access_test.go index 2543b75a2..a689b1715 100644 --- a/test/calico/metadata_access_test.go +++ b/test/calico/metadata_access_test.go @@ -54,7 +54,6 @@ spec: ` retryInterval = 1 * time.Second - timeout = 5 * time.Minute ) func TestNoMetadataAccessRandomPod(t *testing.T) { //nolint:funlen @@ -99,7 +98,7 @@ func TestNoMetadataAccessRandomPod(t *testing.T) { //nolint:funlen podsclient := client.Pods(ns.ObjectMeta.Name) // Retry pod creation. This might fail if Linkerd is not ready yet and some requests might fail. - if err := wait.PollImmediate(retryInterval, timeout, func() (done bool, err error) { + if err := wait.PollImmediate(retryInterval, testutil.Timeout, func() (done bool, err error) { p, err = podsclient.Create(context.TODO(), p, metav1.CreateOptions{}) if err != nil { t.Logf("retrying pod creation, failed with: %v", err) @@ -114,7 +113,7 @@ func TestNoMetadataAccessRandomPod(t *testing.T) { //nolint:funlen phase := corev1.PodUnknown - if err := wait.PollImmediate(retryInterval, timeout, func() (done bool, err error) { + if err := wait.PollImmediate(retryInterval, testutil.Timeout, func() (done bool, err error) { p, err := podsclient.Get(context.TODO(), p.ObjectMeta.Name, metav1.GetOptions{}) if err != nil { return false, err diff --git a/test/components/aws-ebs-csi-driver/aws-ebs-csi-driver_test.go b/test/components/aws-ebs-csi-driver/aws-ebs-csi-driver_test.go index a9992ca35..7c78282f6 100644 --- a/test/components/aws-ebs-csi-driver/aws-ebs-csi-driver_test.go +++ b/test/components/aws-ebs-csi-driver/aws-ebs-csi-driver_test.go @@ -21,7 +21,6 @@ package awsebscsidriver import ( "fmt" "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -43,7 +42,7 @@ func TestCSIDriverDeployments(t *testing.T) { test := test t.Run(fmt.Sprintf("aws-ebs-csi-driver deployment:%s", test.deployment), func(t *testing.T) { t.Parallel() - testutil.WaitForDeployment(t, client, namespace, test.deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, test.deployment, testutil.RetryInterval, testutil.Timeout) }) } } diff --git a/test/components/cert-manager/cert-manager_test.go b/test/components/cert-manager/cert-manager_test.go index 2d7b69a96..9eb36845b 100644 --- a/test/components/cert-manager/cert-manager_test.go +++ b/test/components/cert-manager/cert-manager_test.go @@ -20,7 +20,6 @@ package certmanager import ( "fmt" "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -47,7 +46,7 @@ func TestCertManagerDeployments(t *testing.T) { for _, test := range testCases { t.Run(fmt.Sprintf("cert-manager deployment:%s", test.deployment), func(t *testing.T) { t.Parallel() - testutil.WaitForDeployment(t, client, namespace, test.deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, test.deployment, testutil.RetryInterval, testutil.Timeout) //nolint:goscope }) } } diff --git a/test/components/cluster-autoscaler/cluster-autoscaler_test.go b/test/components/cluster-autoscaler/cluster-autoscaler_test.go index 30b0abd29..20624401c 100644 --- a/test/components/cluster-autoscaler/cluster-autoscaler_test.go +++ b/test/components/cluster-autoscaler/cluster-autoscaler_test.go @@ -19,15 +19,12 @@ package clusterautoscaler import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) const ( - defaultDeploymentTimeout = 5 * time.Minute - defaultDeploymentProbeInterval = 5 * time.Second - name = "cluster-autoscaler-packet-cluster-autoscaler-chart" + name = "cluster-autoscaler-packet-cluster-autoscaler-chart" ) func TestClusterAutoscalerDeployments(t *testing.T) { @@ -36,6 +33,6 @@ func TestClusterAutoscalerDeployments(t *testing.T) { t.Run("deployment", func(t *testing.T) { t.Parallel() - testutil.WaitForDeployment(t, client, "kube-system", name, defaultDeploymentProbeInterval, defaultDeploymentTimeout) + testutil.WaitForDeployment(t, client, "kube-system", name, testutil.RetryInterval, testutil.Timeout) }) } diff --git a/test/components/contour/contour_test.go b/test/components/contour/contour_test.go index 9bf8f4ccf..9778d48a4 100644 --- a/test/components/contour/contour_test.go +++ b/test/components/contour/contour_test.go @@ -19,7 +19,6 @@ package contour import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -31,7 +30,7 @@ func TestEnvoyDaemonset(t *testing.T) { client := testutil.CreateKubeClient(t) - testutil.WaitForDaemonSet(t, client, namespace, daemonset, time.Second*5, time.Minute*5) + testutil.WaitForDaemonSet(t, client, namespace, daemonset, testutil.RetryInterval, testutil.Timeout) } func TestContourDeployment(t *testing.T) { @@ -41,5 +40,5 @@ func TestContourDeployment(t *testing.T) { client := testutil.CreateKubeClient(t) - testutil.WaitForDeployment(t, client, namespace, deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) } diff --git a/test/components/coredns/coredns_test.go b/test/components/coredns/coredns_test.go index f660cad3f..f0b0adbd6 100644 --- a/test/components/coredns/coredns_test.go +++ b/test/components/coredns/coredns_test.go @@ -19,7 +19,6 @@ package coredns import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -31,5 +30,5 @@ func TestCoreDNSDeployment(t *testing.T) { client := testutil.CreateKubeClient(t) - testutil.WaitForDeployment(t, client, namespace, deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) } diff --git a/test/components/dex/dex_test.go b/test/components/dex/dex_test.go index 4a02c91c3..651782b55 100644 --- a/test/components/dex/dex_test.go +++ b/test/components/dex/dex_test.go @@ -19,7 +19,6 @@ package dex import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -33,6 +32,6 @@ func TestDexDeployment(t *testing.T) { t.Parallel() deployment := "dex" - testutil.WaitForDeployment(t, client, namespace, deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) }) } diff --git a/test/components/external-dns/external-dns_test.go b/test/components/external-dns/external-dns_test.go index da76bfef8..e4eca308c 100644 --- a/test/components/external-dns/external-dns_test.go +++ b/test/components/external-dns/external-dns_test.go @@ -19,9 +19,9 @@ package externaldns import ( "fmt" - testutil "github.com/kinvolk/lokomotive/test/components/util" "testing" - "time" + + testutil "github.com/kinvolk/lokomotive/test/components/util" ) const namespace = "external-dns" @@ -32,6 +32,6 @@ func TestExternalDNSDeployments(t *testing.T) { t.Run(fmt.Sprintf("deployment"), func(t *testing.T) { t.Parallel() deployment := "external-dns" - testutil.WaitForDeployment(t, client, namespace, deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) }) } diff --git a/test/components/flatcar-linux-update-operator/fluo_test.go b/test/components/flatcar-linux-update-operator/fluo_test.go index e02be5b9b..0f86a357d 100644 --- a/test/components/flatcar-linux-update-operator/fluo_test.go +++ b/test/components/flatcar-linux-update-operator/fluo_test.go @@ -19,7 +19,6 @@ package fluo import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -31,7 +30,7 @@ func TestUpdateAgentDaemonset(t *testing.T) { client := testutil.CreateKubeClient(t) - testutil.WaitForDaemonSet(t, client, namespace, daemonset, time.Second*5, time.Minute*5) + testutil.WaitForDaemonSet(t, client, namespace, daemonset, testutil.RetryInterval, testutil.Timeout) } func TestUpdateOperatorDeployment(t *testing.T) { @@ -41,5 +40,5 @@ func TestUpdateOperatorDeployment(t *testing.T) { client := testutil.CreateKubeClient(t) - testutil.WaitForDeployment(t, client, namespace, deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) } diff --git a/test/components/gangway/gangway_test.go b/test/components/gangway/gangway_test.go index 030174a12..61d7b10c5 100644 --- a/test/components/gangway/gangway_test.go +++ b/test/components/gangway/gangway_test.go @@ -19,7 +19,6 @@ package gangway import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -33,6 +32,6 @@ func TestGangwayDeployment(t *testing.T) { t.Parallel() deployment := "gangway" - testutil.WaitForDeployment(t, client, namespace, deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) }) } diff --git a/test/components/httpbin/httpbin_test.go b/test/components/httpbin/httpbin_test.go index 900a456d4..d17f9de34 100644 --- a/test/components/httpbin/httpbin_test.go +++ b/test/components/httpbin/httpbin_test.go @@ -20,22 +20,16 @@ package httpbin import ( "fmt" "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) -const ( - defaultDeploymentTimeout = 5 * time.Minute - defaultDeploymentProbeInterval = 5 * time.Second -) - func TestHttpbinDeployments(t *testing.T) { client := testutil.CreateKubeClient(t) t.Run(fmt.Sprintf("deployment"), func(t *testing.T) { t.Parallel() - testutil.WaitForDeployment(t, client, "httpbin", "httpbin", defaultDeploymentProbeInterval, defaultDeploymentTimeout) + testutil.WaitForDeployment(t, client, "httpbin", "httpbin", testutil.RetryInterval, testutil.Timeout) }) } diff --git a/test/components/istio/istio_test.go b/test/components/istio/istio_test.go index 68342a40e..c48e37563 100644 --- a/test/components/istio/istio_test.go +++ b/test/components/istio/istio_test.go @@ -19,16 +19,10 @@ package istio_test import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) -const ( - retryInterval = 3 * time.Second - timeout = 7 * time.Minute -) - func TestIstioDeployments(t *testing.T) { deployments := []struct { Namespace string @@ -51,7 +45,7 @@ func TestIstioDeployments(t *testing.T) { t.Run(d.Deployment, func(t *testing.T) { t.Parallel() - testutil.WaitForDeployment(t, client, d.Namespace, d.Deployment, retryInterval, timeout) + testutil.WaitForDeployment(t, client, d.Namespace, d.Deployment, testutil.RetryInterval, testutil.TimeoutSlower) }) } } diff --git a/test/components/kubernetes/controller-manager_test.go b/test/components/kubernetes/controller-manager_test.go index 4d4ca97a6..118c6584f 100644 --- a/test/components/kubernetes/controller-manager_test.go +++ b/test/components/kubernetes/controller-manager_test.go @@ -31,5 +31,5 @@ func TestControllerManagerDeployment(t *testing.T) { client := testutil.CreateKubeClient(t) - testutil.WaitForDeployment(t, client, namespace, deployment, retryInterval, timeout) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) } diff --git a/test/components/kubernetes/kubelet_disruptive_test.go b/test/components/kubernetes/kubelet_disruptive_test.go index a983e1464..f9dd48fdf 100644 --- a/test/components/kubernetes/kubelet_disruptive_test.go +++ b/test/components/kubernetes/kubelet_disruptive_test.go @@ -20,7 +20,6 @@ package kubernetes import ( "context" "testing" - "time" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,10 +48,8 @@ func TestSelfHostedKubeletLabels(t *testing.T) { t.Errorf("could not delete the node %s: %v", chosenNode, err) } - retryInterval := time.Second * 5 - timeout := time.Minute * 5 // Wait for the node to come up. - if err = wait.PollImmediate(retryInterval, timeout, func() (done bool, err error) { + if err = wait.PollImmediate(testutil.RetryInterval, testutil.Timeout, func() (done bool, err error) { node, err := client.CoreV1().Nodes().Get(context.TODO(), chosenNode, metav1.GetOptions{}) if err != nil { if k8serrors.IsNotFound(err) { diff --git a/test/components/kubernetes/kubelet_test.go b/test/components/kubernetes/kubelet_test.go index 7565eb321..1f3212c35 100644 --- a/test/components/kubernetes/kubelet_test.go +++ b/test/components/kubernetes/kubelet_test.go @@ -19,15 +19,10 @@ package kubernetes import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) -const retryInterval = time.Second * 5 - -const timeout = time.Minute * 5 - func TestSelfHostedKubeletPods(t *testing.T) { t.Parallel() @@ -36,5 +31,5 @@ func TestSelfHostedKubeletPods(t *testing.T) { namespace := "kube-system" daemonset := "kubelet" - testutil.WaitForDaemonSet(t, client, namespace, daemonset, retryInterval, timeout) + testutil.WaitForDaemonSet(t, client, namespace, daemonset, testutil.RetryInterval, testutil.Timeout) } diff --git a/test/components/linkerd/linkerd_test.go b/test/components/linkerd/linkerd_test.go index d00613166..b00e6e960 100644 --- a/test/components/linkerd/linkerd_test.go +++ b/test/components/linkerd/linkerd_test.go @@ -22,7 +22,6 @@ import ( "fmt" "io/ioutil" "testing" - "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -58,7 +57,7 @@ func TestLinkerdDeployment(t *testing.T) { t.Run(d, func(t *testing.T) { t.Parallel() - testutil.WaitForDeployment(t, client, namespace, d, retryInterval, timeout) + testutil.WaitForDeployment(t, client, namespace, d, testutil.RetryInterval, testutil.TimeoutSlower) }) } } @@ -116,9 +115,6 @@ spec: - name: download-dir emptyDir: {} ` - - retryInterval = 5 * time.Second - timeout = 9 * time.Minute ) //nolint: funlen @@ -160,7 +156,7 @@ func TestLinkerdCheck(t *testing.T) { podsClient := client.Pods(ns.Name) // Retry pod creation. This might fail if Linkerd is not ready yet and some requests might fail. - if err := wait.PollImmediate(retryInterval, timeout, func() (done bool, err error) { + if err := wait.PollImmediate(testutil.RetryInterval, testutil.TimeoutSlower, func() (done bool, err error) { pod, err = podsClient.Create(context.TODO(), pod, metav1.CreateOptions{}) if err != nil { t.Logf("retrying pod creation, failed with: %v", err) @@ -175,7 +171,7 @@ func TestLinkerdCheck(t *testing.T) { phase := corev1.PodUnknown - if err := wait.PollImmediate(retryInterval, timeout, func() (done bool, err error) { + if err := wait.PollImmediate(testutil.RetryInterval, testutil.TimeoutSlower, func() (done bool, err error) { p, err := podsClient.Get(context.TODO(), pod.Name, metav1.GetOptions{}) if err != nil { return false, fmt.Errorf("couldn't get the pod %q: %w", pod.Name, err) diff --git a/test/components/metallb/metallb_test.go b/test/components/metallb/metallb_test.go index db91219e1..dd1ef0e59 100644 --- a/test/components/metallb/metallb_test.go +++ b/test/components/metallb/metallb_test.go @@ -19,7 +19,6 @@ package metallb import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -33,13 +32,13 @@ func TestMetalLBDeployment(t *testing.T) { t.Parallel() daemonset := "speaker" - testutil.WaitForDaemonSet(t, client, namespace, daemonset, time.Second*5, time.Minute*5) + testutil.WaitForDaemonSet(t, client, namespace, daemonset, testutil.RetryInterval, testutil.Timeout) }) t.Run("controller deployment", func(t *testing.T) { t.Parallel() deployment := "controller" - testutil.WaitForDeployment(t, client, namespace, deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) }) } diff --git a/test/components/metrics-server/metrics_server_test.go b/test/components/metrics-server/metrics_server_test.go index d9863b5a3..fd292231b 100644 --- a/test/components/metrics-server/metrics_server_test.go +++ b/test/components/metrics-server/metrics_server_test.go @@ -19,7 +19,6 @@ package metricsserver import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -33,6 +32,6 @@ func TestMetricsServerDeployment(t *testing.T) { t.Parallel() deployment := "metrics-server" - testutil.WaitForDeployment(t, client, namespace, deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) }) } diff --git a/test/components/openebs-operator/openebs_operator_test.go b/test/components/openebs-operator/openebs_operator_test.go index eea9f8a54..66c6a3857 100644 --- a/test/components/openebs-operator/openebs_operator_test.go +++ b/test/components/openebs-operator/openebs_operator_test.go @@ -19,7 +19,6 @@ package openebsoperator import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -42,7 +41,7 @@ func TestOpenEBSOperatorDeployment(t *testing.T) { t.Run("deployment", func(t *testing.T) { t.Parallel() - testutil.WaitForDeployment(t, client, namespace, deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) //nolint:goscope }) } } diff --git a/test/components/patch_serviceaccount_test.go b/test/components/patch_serviceaccount_test.go index 750ccb61e..5339f74fe 100644 --- a/test/components/patch_serviceaccount_test.go +++ b/test/components/patch_serviceaccount_test.go @@ -30,8 +30,6 @@ import ( ) const ( - retryInterval = time.Second * 5 - timeout = time.Minute * 5 contextTimeout = 10 ) @@ -50,7 +48,7 @@ func TestDisableAutomountServiceAccountToken(t *testing.T) { t.Parallel() if err := wait.PollImmediate( - retryInterval, timeout, checkDefaultServiceAccountPatch(client, name), + testutil.RetryInterval, testutil.Timeout, checkDefaultServiceAccountPatch(client, name), ); err != nil { t.Fatalf("%v", err) } diff --git a/test/components/prometheus-operator/prometheus_operator_test.go b/test/components/prometheus-operator/prometheus_operator_test.go index 6f16ffd0e..612f4eae6 100644 --- a/test/components/prometheus-operator/prometheus_operator_test.go +++ b/test/components/prometheus-operator/prometheus_operator_test.go @@ -23,7 +23,6 @@ import ( "fmt" "strings" "testing" - "time" v1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -37,8 +36,6 @@ import ( ) const ( - retryInterval = time.Second * 5 - timeout = time.Minute * 9 namespace = "monitoring" grafanaDeployment = "prometheus-operator-grafana" ) @@ -57,7 +54,7 @@ func TestPrometheusOperatorDeployment(t *testing.T) { t.Run("deployment", func(t *testing.T) { t.Parallel() - testutil.WaitForDeployment(t, client, namespace, deployment, retryInterval, timeout) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.TimeoutSlower) }) } @@ -72,11 +69,11 @@ func TestPrometheusOperatorDeployment(t *testing.T) { t.Parallel() replicas := 1 - testutil.WaitForStatefulSet(t, client, namespace, statefulset, replicas, retryInterval, timeout) + testutil.WaitForStatefulSet(t, client, namespace, statefulset, replicas, testutil.RetryInterval, testutil.TimeoutSlower) }) } - testutil.WaitForDaemonSet(t, client, namespace, "prometheus-operator-prometheus-node-exporter", retryInterval, timeout) + testutil.WaitForDaemonSet(t, client, namespace, "prometheus-operator-prometheus-node-exporter", testutil.RetryInterval, testutil.TimeoutSlower) } //nolint:funlen @@ -96,7 +93,7 @@ func TestGrafanaLoadsEnvVars(t *testing.T) { } // We will wait until the Grafana Pods are up and running so we don't have to reimplement wait logic again. - testutil.WaitForDeployment(t, client, namespace, grafanaDeployment, retryInterval, timeout) + testutil.WaitForDeployment(t, client, namespace, grafanaDeployment, testutil.RetryInterval, testutil.TimeoutSlower) // Get grafana deployment object so that we can get the corresponding pod. deploy, err := client.AppsV1().Deployments(namespace).Get(context.TODO(), grafanaDeployment, metav1.GetOptions{}) diff --git a/test/components/rook/rook_test.go b/test/components/rook/rook_test.go index 339d43ab7..9b84269ce 100644 --- a/test/components/rook/rook_test.go +++ b/test/components/rook/rook_test.go @@ -19,7 +19,6 @@ package rook import ( "testing" - "time" testutil "github.com/kinvolk/lokomotive/test/components/util" ) @@ -33,6 +32,6 @@ func TestRookDeployment(t *testing.T) { t.Parallel() deployment := "rook-ceph-operator" - testutil.WaitForDeployment(t, client, namespace, deployment, time.Second*5, time.Minute*5) + testutil.WaitForDeployment(t, client, namespace, deployment, testutil.RetryInterval, testutil.Timeout) }) } diff --git a/test/components/util/util.go b/test/components/util/util.go index 7379f0a11..5a872af56 100644 --- a/test/components/util/util.go +++ b/test/components/util/util.go @@ -40,6 +40,15 @@ import ( "k8s.io/client-go/transport/spdy" ) +const ( + // RetryInterval is time for test to retry. + RetryInterval = time.Second * 5 + // Timeout is time after which tests stops and fails. + Timeout = time.Minute * 5 + // TimeoutSlower is time after which tests stops and fails. + TimeoutSlower = time.Minute * 9 +) + func KubeconfigPath(t *testing.T) string { kubeconfig := os.ExpandEnv(os.Getenv("KUBECONFIG")) diff --git a/test/ingress/aws/aws_test.go b/test/ingress/aws/aws_test.go index ab78c3b40..e5c9806dc 100644 --- a/test/ingress/aws/aws_test.go +++ b/test/ingress/aws/aws_test.go @@ -33,9 +33,7 @@ import ( ) const ( - retryInterval = 5 * time.Second - retryTimeout = 9 * time.Minute - httpTimeout = 4 * time.Second + httpTimeout = 4 * time.Second ) func TestAWSIngress(t *testing.T) { @@ -71,7 +69,7 @@ func TestAWSIngress(t *testing.T) { h := i.Spec.Rules[0].Host c := getHTTPClient() - err = wait.PollImmediate(retryInterval, retryTimeout, func() (bool, error) { + err = wait.PollImmediate(testutil.RetryInterval, testutil.TimeoutSlower, func() (bool, error) { resp, err := c.Get(fmt.Sprintf("https://%s/get", h)) if err != nil { t.Logf("got an HTTP error: %v", err) diff --git a/test/ingress/packet_test/match_host_test.go b/test/ingress/packet_test/match_host_test.go index efd89a0a2..f9364f49c 100644 --- a/test/ingress/packet_test/match_host_test.go +++ b/test/ingress/packet_test/match_host_test.go @@ -31,8 +31,6 @@ import ( ) const ( - retryInterval = time.Second * 5 - timeout = time.Minute * 5 contextTimeout = 10 ) @@ -67,7 +65,7 @@ func TestIngressHost(t *testing.T) { } if err := wait.PollImmediate( - retryInterval, timeout, checkIngressHost(client, tc), + testutil.RetryInterval, testutil.Timeout, checkIngressHost(client, tc), ); err != nil { t.Fatalf("%v", err) } diff --git a/test/monitoring/components_alerts_test.go b/test/monitoring/components_alerts_test.go index 1c3ba1b17..288081521 100644 --- a/test/monitoring/components_alerts_test.go +++ b/test/monitoring/components_alerts_test.go @@ -31,8 +31,6 @@ import ( ) const ( - retryInterval = time.Second * 5 - timeout = time.Minute * 9 contextTimeout = 10 ) @@ -72,7 +70,7 @@ func testComponentAlerts(t *testing.T, v1api v1.API) { } if err := wait.PollImmediate( - retryInterval, timeout, getComponentAlertRetryFunc(t, v1api, tc), + testutil.RetryInterval, testutil.TimeoutSlower, getComponentAlertRetryFunc(t, v1api, tc), ); err != nil { t.Fatalf("%v", err) } diff --git a/test/monitoring/components_metrics_test.go b/test/monitoring/components_metrics_test.go index fb21e8a14..d5028dd69 100644 --- a/test/monitoring/components_metrics_test.go +++ b/test/monitoring/components_metrics_test.go @@ -120,8 +120,8 @@ func testComponentsPrometheusMetrics(t *testing.T, v1api v1.API) { t.Logf("querying %q", tc.query) - if err := wait.PollImmediate(retryInterval, timeout, getMetricRetryFunc(t, v1api, tc.query)); err != nil { - t.Errorf("%v", err) + if err := wait.PollImmediate(testutil.RetryInterval, testutil.TimeoutSlower, getMetricRetryFunc(t, v1api, tc.query)); err != nil { + t.Errorf("%v", err) //nolint:lll } }) } diff --git a/test/monitoring/scrape_targets_test.go b/test/monitoring/scrape_targets_test.go index dae006603..8dd6e6e73 100644 --- a/test/monitoring/scrape_targets_test.go +++ b/test/monitoring/scrape_targets_test.go @@ -25,6 +25,7 @@ import ( "text/tabwriter" "time" + testutil "github.com/kinvolk/lokomotive/test/components/util" v1 "github.com/prometheus/client_golang/api/prometheus/v1" "k8s.io/apimachinery/pkg/util/wait" ) @@ -33,7 +34,7 @@ func testScrapeTargetRechability(t *testing.T, v1api v1.API) { var w *tabwriter.Writer if err := wait.PollImmediate( - retryInterval, timeout, getScrapeTargetRetryFunc(t, v1api, w), + testutil.RetryInterval, testutil.TimeoutSlower, getScrapeTargetRetryFunc(t, v1api, w), ); err != nil { t.Errorf("%v", err)