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.
This commit is contained in:
Lubomir I. Ivanov 2023-10-31 17:37:10 +02:00
parent 05076de57f
commit c2a365c6a7

View File

@ -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)
}