Skip to content

Commit

Permalink
kubeadm: do not poll in TestEnsureAdminClusterRoleBindingImpl
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
neolit123 committed Oct 31, 2023
1 parent 05076de commit c2a365c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit c2a365c

Please sign in to comment.