Increase test timeouts to avoid CI test failures (#3554)

This commit is contained in:
Nikola Jokic 2024-06-21 13:45:48 +02:00 committed by GitHub
parent 6276c84493
commit b349ded2be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 64 additions and 65 deletions

View File

@ -25,7 +25,7 @@ import (
) )
const ( const (
autoscalingListenerTestTimeout = time.Second * 5 autoscalingListenerTestTimeout = time.Second * 20
autoscalingListenerTestInterval = time.Millisecond * 250 autoscalingListenerTestInterval = time.Millisecond * 250
autoscalingListenerTestGitHubToken = "gh_token" autoscalingListenerTestGitHubToken = "gh_token"
) )

View File

@ -34,7 +34,7 @@ import (
) )
const ( const (
autoscalingRunnerSetTestTimeout = time.Second * 5 autoscalingRunnerSetTestTimeout = time.Second * 20
autoscalingRunnerSetTestInterval = time.Millisecond * 250 autoscalingRunnerSetTestInterval = time.Millisecond * 250
autoscalingRunnerSetTestGitHubToken = "gh_token" autoscalingRunnerSetTestGitHubToken = "gh_token"
) )

View File

@ -29,9 +29,9 @@ import (
) )
const ( const (
timeout = time.Second * 10 ephemeralRunnerTimeout = time.Second * 20
interval = time.Millisecond * 250 ephemeralRunnerInterval = time.Millisecond * 250
runnerImage = "ghcr.io/actions/actions-runner:latest" runnerImage = "ghcr.io/actions/actions-runner:latest"
) )
func newExampleRunner(name, namespace, configSecretName string) *v1alpha1.EphemeralRunner { func newExampleRunner(name, namespace, configSecretName string) *v1alpha1.EphemeralRunner {
@ -133,8 +133,8 @@ var _ = Describe("EphemeralRunner", func() {
n := len(created.Finalizers) // avoid capacity mismatch n := len(created.Finalizers) // avoid capacity mismatch
return created.Finalizers[:n:n], nil return created.Finalizers[:n:n], nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo([]string{ephemeralRunnerFinalizerName, ephemeralRunnerActionsFinalizerName})) ).Should(BeEquivalentTo([]string{ephemeralRunnerFinalizerName, ephemeralRunnerActionsFinalizerName}))
Eventually( Eventually(
@ -147,8 +147,8 @@ var _ = Describe("EphemeralRunner", func() {
_, ok := secret.Data[jitTokenKey] _, ok := secret.Data[jitTokenKey]
return ok, nil return ok, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
Eventually( Eventually(
@ -160,8 +160,8 @@ var _ = Describe("EphemeralRunner", func() {
return pod.Name, nil return pod.Name, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(ephemeralRunner.Name)) ).Should(BeEquivalentTo(ephemeralRunner.Name))
}) })
@ -184,8 +184,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return true, nil return true, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
}) })
@ -203,7 +203,7 @@ var _ = Describe("EphemeralRunner", func() {
return "", nil return "", nil
} }
return updated.Status.Phase, nil return updated.Status.Phase, nil
}, timeout, interval).Should(BeEquivalentTo(corev1.PodFailed)) }, ephemeralRunnerTimeout, ephemeralRunnerInterval).Should(BeEquivalentTo(corev1.PodFailed))
Expect(updated.Status.Reason).Should(Equal("InvalidPod")) Expect(updated.Status.Reason).Should(Equal("InvalidPod"))
Expect(updated.Status.Message).Should(Equal("Failed to create the pod: pods \"invalid-ephemeral-runner\" is forbidden: no PriorityClass with name notexist was found")) Expect(updated.Status.Message).Should(Equal("Failed to create the pod: pods \"invalid-ephemeral-runner\" is forbidden: no PriorityClass with name notexist was found"))
}) })
@ -247,8 +247,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return true, nil return true, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
// create runner linked secret // create runner linked secret
@ -273,8 +273,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return true, nil return true, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
err = k8sClient.Delete(ctx, ephemeralRunner) err = k8sClient.Delete(ctx, ephemeralRunner)
@ -289,8 +289,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return kerrors.IsNotFound(err), nil return kerrors.IsNotFound(err), nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
Eventually( Eventually(
@ -302,8 +302,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return kerrors.IsNotFound(err), nil return kerrors.IsNotFound(err), nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
Eventually( Eventually(
@ -315,8 +315,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return kerrors.IsNotFound(err), nil return kerrors.IsNotFound(err), nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
Eventually( Eventually(
@ -328,8 +328,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return kerrors.IsNotFound(err), nil return kerrors.IsNotFound(err), nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
Eventually( Eventually(
@ -341,8 +341,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return kerrors.IsNotFound(err), nil return kerrors.IsNotFound(err), nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
}) })
@ -356,8 +356,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return updatedEphemeralRunner.Status.RunnerId, nil return updatedEphemeralRunner.Status.RunnerId, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeNumerically(">", 0)) ).Should(BeNumerically(">", 0))
}) })
@ -371,8 +371,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return true, nil return true, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
for _, phase := range []corev1.PodPhase{corev1.PodRunning, corev1.PodPending} { for _, phase := range []corev1.PodPhase{corev1.PodRunning, corev1.PodPending} {
@ -395,8 +395,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return updated.Status.Phase, nil return updated.Status.Phase, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(phase)) ).Should(BeEquivalentTo(phase))
} }
}) })
@ -411,8 +411,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return true, nil return true, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
pod.Status.Phase = corev1.PodRunning pod.Status.Phase = corev1.PodRunning
@ -427,7 +427,7 @@ var _ = Describe("EphemeralRunner", func() {
} }
return updated.Status.Phase, nil return updated.Status.Phase, nil
}, },
timeout, ephemeralRunnerTimeout,
).Should(BeEquivalentTo("")) ).Should(BeEquivalentTo(""))
}) })
@ -462,8 +462,8 @@ var _ = Describe("EphemeralRunner", func() {
Expect(err).To(BeNil(), "Failed to update pod status") Expect(err).To(BeNil(), "Failed to update pod status")
return false, fmt.Errorf("pod haven't failed for 5 times.") return false, fmt.Errorf("pod haven't failed for 5 times.")
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true), "we should stop creating pod after 5 failures") ).Should(BeEquivalentTo(true), "we should stop creating pod after 5 failures")
// In case we still have pod created due to controller-runtime cache delay, mark the container as exited // In case we still have pod created due to controller-runtime cache delay, mark the container as exited
@ -488,7 +488,7 @@ var _ = Describe("EphemeralRunner", func() {
return "", err return "", err
} }
return updated.Status.Reason, nil return updated.Status.Reason, nil
}, timeout, interval).Should(BeEquivalentTo("TooManyPodFailures"), "Reason should be TooManyPodFailures") }, ephemeralRunnerTimeout, ephemeralRunnerInterval).Should(BeEquivalentTo("TooManyPodFailures"), "Reason should be TooManyPodFailures")
// EphemeralRunner should not have any pod // EphemeralRunner should not have any pod
Eventually(func() (bool, error) { Eventually(func() (bool, error) {
@ -497,7 +497,7 @@ var _ = Describe("EphemeralRunner", func() {
return false, nil return false, nil
} }
return kerrors.IsNotFound(err), nil return kerrors.IsNotFound(err), nil
}, timeout, interval).Should(BeEquivalentTo(true)) }, ephemeralRunnerTimeout, ephemeralRunnerInterval).Should(BeEquivalentTo(true))
}) })
It("It should re-create pod on eviction", func() { It("It should re-create pod on eviction", func() {
@ -510,8 +510,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return true, nil return true, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
pod.Status.Phase = corev1.PodFailed pod.Status.Phase = corev1.PodFailed
@ -530,7 +530,7 @@ var _ = Describe("EphemeralRunner", func() {
return false, err return false, err
} }
return len(updated.Status.Failures) == 1, nil return len(updated.Status.Failures) == 1, nil
}, timeout, interval).Should(BeEquivalentTo(true)) }, ephemeralRunnerTimeout, ephemeralRunnerInterval).Should(BeEquivalentTo(true))
// should re-create after failure // should re-create after failure
Eventually( Eventually(
@ -541,8 +541,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return true, nil return true, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
}) })
@ -555,8 +555,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return true, nil return true, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
pod.Status.ContainerStatuses = append(pod.Status.ContainerStatuses, corev1.ContainerStatus{ pod.Status.ContainerStatuses = append(pod.Status.ContainerStatuses, corev1.ContainerStatus{
@ -577,7 +577,7 @@ var _ = Describe("EphemeralRunner", func() {
return false, err return false, err
} }
return len(updated.Status.Failures) == 1, nil return len(updated.Status.Failures) == 1, nil
}, timeout, interval).Should(BeEquivalentTo(true)) }, ephemeralRunnerTimeout, ephemeralRunnerInterval).Should(BeEquivalentTo(true))
// should re-create after failure // should re-create after failure
Eventually( Eventually(
@ -588,8 +588,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return true, nil return true, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
}) })
@ -602,8 +602,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return true, nil return true, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
// first set phase to running // first set phase to running
@ -627,8 +627,8 @@ var _ = Describe("EphemeralRunner", func() {
} }
return updated.Status.Phase, nil return updated.Status.Phase, nil
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(corev1.PodRunning)) ).Should(BeEquivalentTo(corev1.PodRunning))
// set phase to succeeded // set phase to succeeded
@ -644,7 +644,7 @@ var _ = Describe("EphemeralRunner", func() {
} }
return updated.Status.Phase, nil return updated.Status.Phase, nil
}, },
timeout, ephemeralRunnerTimeout,
).Should(BeEquivalentTo(corev1.PodRunning)) ).Should(BeEquivalentTo(corev1.PodRunning))
}) })
}) })
@ -700,7 +700,7 @@ var _ = Describe("EphemeralRunner", func() {
return false, err return false, err
} }
return true, nil return true, nil
}, timeout, interval).Should(BeEquivalentTo(true)) }, ephemeralRunnerTimeout, ephemeralRunnerInterval).Should(BeEquivalentTo(true))
pod.Status.ContainerStatuses = append(pod.Status.ContainerStatuses, corev1.ContainerStatus{ pod.Status.ContainerStatuses = append(pod.Status.ContainerStatuses, corev1.ContainerStatus{
Name: EphemeralRunnerContainerName, Name: EphemeralRunnerContainerName,
@ -720,7 +720,7 @@ var _ = Describe("EphemeralRunner", func() {
return "", nil return "", nil
} }
return updated.Status.Phase, nil return updated.Status.Phase, nil
}, timeout, interval).Should(BeEquivalentTo(corev1.PodSucceeded)) }, ephemeralRunnerTimeout, ephemeralRunnerInterval).Should(BeEquivalentTo(corev1.PodSucceeded))
}) })
}) })
@ -800,7 +800,7 @@ var _ = Describe("EphemeralRunner", func() {
return proxySuccessfulllyCalled return proxySuccessfulllyCalled
}, },
2*time.Second, 2*time.Second,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
}) })
@ -825,8 +825,8 @@ var _ = Describe("EphemeralRunner", func() {
err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunner.Name, Namespace: ephemeralRunner.Namespace}, pod) err := k8sClient.Get(ctx, client.ObjectKey{Name: ephemeralRunner.Name, Namespace: ephemeralRunner.Namespace}, pod)
g.Expect(err).To(BeNil(), "failed to get ephemeral runner pod") g.Expect(err).To(BeNil(), "failed to get ephemeral runner pod")
}, },
timeout, ephemeralRunnerTimeout,
interval, ephemeralRunnerInterval,
).Should(Succeed(), "failed to get ephemeral runner pod") ).Should(Succeed(), "failed to get ephemeral runner pod")
Expect(pod.Spec.Containers[0].Env).To(ContainElement(corev1.EnvVar{ Expect(pod.Spec.Containers[0].Env).To(ContainElement(corev1.EnvVar{
@ -958,7 +958,7 @@ var _ = Describe("EphemeralRunner", func() {
return serverSuccessfullyCalled return serverSuccessfullyCalled
}, },
2*time.Second, 2*time.Second,
interval, ephemeralRunnerInterval,
).Should(BeTrue(), "failed to contact server") ).Should(BeTrue(), "failed to contact server")
}) })
}) })

View File

@ -30,7 +30,7 @@ import (
) )
const ( const (
ephemeralRunnerSetTestTimeout = time.Second * 10 ephemeralRunnerSetTestTimeout = time.Second * 20
ephemeralRunnerSetTestInterval = time.Millisecond * 250 ephemeralRunnerSetTestInterval = time.Millisecond * 250
ephemeralRunnerSetTestGitHubToken = "gh_token" ephemeralRunnerSetTestGitHubToken = "gh_token"
) )
@ -794,7 +794,6 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
} }
return len(runnerList.Items), nil return len(runnerList.Items), nil
}, },
ephemeralRunnerSetTestTimeout, ephemeralRunnerSetTestTimeout,
ephemeralRunnerSetTestInterval, ephemeralRunnerSetTestInterval,
@ -1359,7 +1358,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func(
return proxySuccessfulllyCalled return proxySuccessfulllyCalled
}, },
2*time.Second, 2*time.Second,
interval, ephemeralRunnerInterval,
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
}) })
}) })