diff --git a/internal/controller/conditionsutil/conditions_util_test.go b/internal/controller/conditionsutil/conditions_util_test.go index 373d6adee..ceb4aee53 100644 --- a/internal/controller/conditionsutil/conditions_util_test.go +++ b/internal/controller/conditionsutil/conditions_util_test.go @@ -166,7 +166,6 @@ func TestMergeIDPConditions(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { var log bytes.Buffer logger := plog.TestLogger(t, &log) diff --git a/internal/controller/supervisorconfig/githubupstreamwatcher/github_upstream_watcher_test.go b/internal/controller/supervisorconfig/githubupstreamwatcher/github_upstream_watcher_test.go index 8d42a5b89..162b0fd7d 100644 --- a/internal/controller/supervisorconfig/githubupstreamwatcher/github_upstream_watcher_test.go +++ b/internal/controller/supervisorconfig/githubupstreamwatcher/github_upstream_watcher_test.go @@ -1814,7 +1814,6 @@ func TestController(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -1872,7 +1871,7 @@ func TestController(t *testing.T) { // Verify what's in the cache actualIDPList := cache.GetGitHubIdentityProviders() require.Equal(t, len(tt.wantResultingCache), len(actualIDPList)) - for i := 0; i < len(tt.wantResultingCache); i++ { + for i := range len(tt.wantResultingCache) { // Do not expect any particular order in the cache var actualProvider *upstreamgithub.Provider for _, possibleIDP := range actualIDPList { @@ -1907,7 +1906,7 @@ func TestController(t *testing.T) { require.NoError(t, err) require.Equal(t, len(tt.wantResultingUpstreams), len(allGitHubIDPs.Items)) - for i := 0; i < len(tt.wantResultingUpstreams); i++ { + for i := range len(tt.wantResultingUpstreams) { require.Len(t, tt.wantResultingUpstreams[i].Status.Conditions, countExpectedConditions) // Do not expect any particular order in the K8s objects @@ -1924,7 +1923,7 @@ func TestController(t *testing.T) { // Update all expected conditions to the frozenTime. // TODO: Push this out to the test table - for j := 0; j < countExpectedConditions; j++ { + for j := range countExpectedConditions { // Get this as a pointer so that we can update the value within the array condition := &tt.wantResultingUpstreams[i].Status.Conditions[j] condition.LastTransitionTime = metav1.Time{Time: frozenClock.Now()} @@ -2208,7 +2207,6 @@ func TestController_OnlyWantActions(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -2323,7 +2321,6 @@ func TestGitHubUpstreamWatcherControllerFilterSecret(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -2395,7 +2392,6 @@ func TestGitHubUpstreamWatcherControllerFilterGitHubIDP(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/testutil/totp/totp_test.go b/internal/testutil/totp/totp_test.go index 52d4ff197..6a7fcdd75 100644 --- a/internal/testutil/totp/totp_test.go +++ b/internal/testutil/totp/totp_test.go @@ -35,7 +35,6 @@ func TestGenerateOTPCode(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/test/integration/supervisor_github_idp_test.go b/test/integration/supervisor_github_idp_test.go index 5192f5442..201d2a527 100644 --- a/test/integration/supervisor_github_idp_test.go +++ b/test/integration/supervisor_github_idp_test.go @@ -231,7 +231,6 @@ func TestGitHubIDPStaticValidationOnCreate_Parallel(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -486,7 +485,6 @@ func TestGitHubIDPPhaseAndConditions_Parallel(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -722,9 +720,9 @@ func TestGitHubIDPTooManyOrganizationsStaticValidationOnCreate_Parallel(t *testi AllowAuthentication: idpv1alpha1.GitHubAllowAuthenticationSpec{ Organizations: idpv1alpha1.GitHubOrganizationsSpec{ Allowed: func() []string { - var orgs []string - for i := 0; i < 100; i++ { - orgs = append(orgs, fmt.Sprintf("org-%d", i)) + orgs := make([]string, 100) + for i := range 100 { + orgs[i] = fmt.Sprintf("org-%d", i) } return orgs }(),