From c2a365c6a7dbfb8000913d2e2913255f95810183 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Tue, 31 Oct 2023 17:37:10 +0200 Subject: [PATCH] kubeadm: do not poll in TestEnsureAdminClusterRoleBindingImpl In EnsureAdminClusterRoleBindingImpl() there are a couple of polls around CRB create calls. When testing the function a short retry and a timeout are used. These introduce around 2x20 fake client "connections" / poll iterations under a couple of test cases with 2 seconds overall test increase. Given the polls in EnsureAdminClusterRoleBindingImpl() are of type PollUntilContextTimeout() with "immediate" set to "true", the short retry / time out can be removed when testing, because one poll iteration is guaranteed and the tested function is at 100% coverage with reactors and test cases. --- cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go index 3705dbaeed5..8b0d49f8e98 100644 --- a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go +++ b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go @@ -933,7 +933,7 @@ func TestEnsureAdminClusterRoleBindingImpl(t *testing.T) { } client, err := EnsureAdminClusterRoleBindingImpl( - context.Background(), adminClient, superAdminClient, time.Millisecond*50, time.Millisecond*1000) + context.Background(), adminClient, superAdminClient, 0, 0) if (err != nil) != tc.expectedError { t.Fatalf("expected error: %v, got %v, error: %v", tc.expectedError, err != nil, err) }