From b7fba54729a097ad53a3064c06b9c78967fd1729 Mon Sep 17 00:00:00 2001 From: Alejandro Pedraza Date: Fri, 23 Jul 2021 10:12:44 -0500 Subject: [PATCH] Fix undeterministic healthcheck unit test coverage, for real (#6542) Followup to #6496 A test was added in #6496 in `healthckeck_test.go` to ensure the `validateControlPlanePods` function was fully covered on every run, but it was actually bailing out early because the `linkerd-destination` and `linkerd-identity` were not included in the list of pods passed. --- pkg/healthcheck/healthcheck_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/healthcheck/healthcheck_test.go b/pkg/healthcheck/healthcheck_test.go index 6b38e08a7..c186f7a45 100644 --- a/pkg/healthcheck/healthcheck_test.go +++ b/pkg/healthcheck/healthcheck_test.go @@ -1463,8 +1463,10 @@ func TestValidateControlPlanePods(t *testing.T) { }) // This test is just for ensuring full coverage of the validateControlPlanePods function - t.Run("Returns an error if the only pod is not ready", func(t *testing.T) { + t.Run("Returns an error if all the controller pods are not ready", func(t *testing.T) { pods := []corev1.Pod{ + pod("linkerd-destination-9849948665-37082", corev1.PodRunning, false), + pod("linkerd-identity-6849948664-27982", corev1.PodRunning, false), pod("linkerd-proxy-injector-5f79ff4844-", corev1.PodRunning, false), }