diff --git a/.golangci.yaml b/.golangci.yaml index 2c872f55e..07dfef586 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -45,6 +45,7 @@ linters: - sqlclosecheck - unconvert - whitespace + - copyloopvar issues: exclude-rules: diff --git a/cmd/pinniped-concierge-kube-cert-agent/main_test.go b/cmd/pinniped-concierge-kube-cert-agent/main_test.go index f6d6d8546..ee8fe3732 100644 --- a/cmd/pinniped-concierge-kube-cert-agent/main_test.go +++ b/cmd/pinniped-concierge-kube-cert-agent/main_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package main @@ -90,7 +90,6 @@ func TestEntrypoint(t *testing.T) { }`, }, } { - tt := tt t.Run(tt.name, func(t *testing.T) { var logBuf bytes.Buffer testLog := log.New(&logBuf, "", 0) diff --git a/cmd/pinniped-server/main_test.go b/cmd/pinniped-server/main_test.go index e262afe31..ee9fe2f96 100644 --- a/cmd/pinniped-server/main_test.go +++ b/cmd/pinniped-server/main_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package main @@ -38,7 +38,6 @@ func TestEntrypoint(t *testing.T) { wantArgs: []string{"/path/to/valid-test-binary", "foo", "bar"}, }, } { - tt := tt t.Run(tt.name, func(t *testing.T) { var logBuf bytes.Buffer testLog := log.New(&logBuf, "", 0) diff --git a/cmd/pinniped/cmd/kubeconfig_test.go b/cmd/pinniped/cmd/kubeconfig_test.go index 1af712dcf..50acdf919 100644 --- a/cmd/pinniped/cmd/kubeconfig_test.go +++ b/cmd/pinniped/cmd/kubeconfig_test.go @@ -3197,7 +3197,6 @@ func TestGetKubeconfig(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { var issuerEndpointPtr *string testServer, testServerCA := tlsserver.TestServerIPv4(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/cmd/pinniped/cmd/login_oidc_test.go b/cmd/pinniped/cmd/login_oidc_test.go index 42b84f9fa..581660210 100644 --- a/cmd/pinniped/cmd/login_oidc_test.go +++ b/cmd/pinniped/cmd/login_oidc_test.go @@ -539,7 +539,6 @@ func TestLoginOIDCCommand(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { var buf bytes.Buffer ctx := plog.AddZapOverridesToContext(context.Background(), t, &buf, nil, clocktesting.NewFakeClock(now)) diff --git a/cmd/pinniped/cmd/login_static_test.go b/cmd/pinniped/cmd/login_static_test.go index 19511edfc..e70a8afb7 100644 --- a/cmd/pinniped/cmd/login_static_test.go +++ b/cmd/pinniped/cmd/login_static_test.go @@ -175,7 +175,6 @@ func TestLoginStaticCommand(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { var buf bytes.Buffer ctx := plog.AddZapOverridesToContext(context.Background(), t, &buf, nil, clocktesting.NewFakeClock(now)) diff --git a/cmd/pinniped/cmd/version_test.go b/cmd/pinniped/cmd/version_test.go index d423eac7c..0d16b87a2 100644 --- a/cmd/pinniped/cmd/version_test.go +++ b/cmd/pinniped/cmd/version_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package cmd @@ -126,7 +126,6 @@ func TestNewVersionCmd(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { if tt.getBuildInfo != nil { getBuildInfo = tt.getBuildInfo diff --git a/cmd/pinniped/cmd/whoami_test.go b/cmd/pinniped/cmd/whoami_test.go index a5cb87107..728953510 100644 --- a/cmd/pinniped/cmd/whoami_test.go +++ b/cmd/pinniped/cmd/whoami_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2023-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package cmd @@ -107,8 +107,7 @@ func TestWhoami(t *testing.T) { Current user info: Username: some-username - Groups: - `), + Groups:` + " \n"), // Linters and codeformatters don't like the extra space after "Groups:" and before the newline }, { name: "json output", @@ -280,7 +279,6 @@ func TestWhoami(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { getClientset := func(clientConfig clientcmd.ClientConfig, apiGroupSuffix string) (conciergeclientset.Interface, error) { if test.gettingClientsetErr != nil { diff --git a/internal/admissionpluginconfig/admissionpluginconfig_test.go b/internal/admissionpluginconfig/admissionpluginconfig_test.go index 52b0a2bb0..3beb96845 100644 --- a/internal/admissionpluginconfig/admissionpluginconfig_test.go +++ b/internal/admissionpluginconfig/admissionpluginconfig_test.go @@ -163,7 +163,6 @@ func TestConfigureAdmissionPlugins(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/backoff/infinitebackoff_test.go b/internal/backoff/infinitebackoff_test.go index 04757dfb1..1de2b1437 100644 --- a/internal/backoff/infinitebackoff_test.go +++ b/internal/backoff/infinitebackoff_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2023-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package backoff @@ -77,7 +77,6 @@ func TestInfiniteBackoff(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { require.NotEmpty(t, tt.expectedSequence) for i, expected := range tt.expectedSequence { diff --git a/internal/backoff/stepping_test.go b/internal/backoff/stepping_test.go index 432f8900b..e4b8cea79 100644 --- a/internal/backoff/stepping_test.go +++ b/internal/backoff/stepping_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2023-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package backoff @@ -81,7 +81,6 @@ func TestWithContext(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { testContext, cancel := context.WithCancel(context.Background()) backoff := &MockStepper{ diff --git a/internal/celtransformer/celformer_test.go b/internal/celtransformer/celformer_test.go index b26d4d474..df4aac44b 100644 --- a/internal/celtransformer/celformer_test.go +++ b/internal/celtransformer/celformer_test.go @@ -780,7 +780,6 @@ func TestTransformer(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/certauthority/certauthority_test.go b/internal/certauthority/certauthority_test.go index 312512064..13b0ca1b1 100644 --- a/internal/certauthority/certauthority_test.go +++ b/internal/certauthority/certauthority_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package certauthority @@ -74,7 +74,6 @@ func TestLoad(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -162,7 +161,6 @@ func TestNewInternal(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { got, err := newInternal("Test CA", tt.ttl, tt.env) if tt.wantErr != "" { @@ -316,7 +314,6 @@ func TestIssue(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { got, err := tt.ca.IssueServerCert([]string{"example.com"}, []net.IP{net.IPv4(1, 2, 3, 4)}, 10*time.Minute) if tt.wantErr != "" { diff --git a/internal/certauthority/dynamiccertauthority/dynamiccertauthority_test.go b/internal/certauthority/dynamiccertauthority/dynamiccertauthority_test.go index cd07d173a..665f6d191 100644 --- a/internal/certauthority/dynamiccertauthority/dynamiccertauthority_test.go +++ b/internal/certauthority/dynamiccertauthority/dynamiccertauthority_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package dynamiccertauthority @@ -89,7 +89,6 @@ func TestCAIssuePEM(t *testing.T) { }, } for _, step := range steps { - step := step t.Run(step.name, func(t *testing.T) { // Can't run these steps in parallel, because each one depends on the previous steps being // run. diff --git a/internal/concierge/impersonator/impersonator_test.go b/internal/concierge/impersonator/impersonator_test.go index 783ae8e07..289a79bea 100644 --- a/internal/concierge/impersonator/impersonator_test.go +++ b/internal/concierge/impersonator/impersonator_test.go @@ -667,7 +667,6 @@ func TestImpersonator(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -1796,7 +1795,6 @@ func TestImpersonatorHTTPHandler(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -2061,7 +2059,6 @@ func Test_withBearerTokenPreservation(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/concierge/impersonator/roundtripper_test.go b/internal/concierge/impersonator/roundtripper_test.go index 0c8fc0e67..ae52a9846 100644 --- a/internal/concierge/impersonator/roundtripper_test.go +++ b/internal/concierge/impersonator/roundtripper_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2023-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package impersonator @@ -72,7 +72,6 @@ func TestRoundTrip(t *testing.T) { wantError: "no impersonator service account token available", }, } { - tt := tt t.Run(tt.name, func(t *testing.T) { base := &fakeRoundTripper{ response: new(http.Response), diff --git a/internal/concierge/scheme/scheme_test.go b/internal/concierge/scheme/scheme_test.go index 5627ada7a..b28bab73d 100644 --- a/internal/concierge/scheme/scheme_test.go +++ b/internal/concierge/scheme/scheme_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package scheme @@ -188,7 +188,6 @@ func TestNew(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { scheme, loginGV, identityGV := New(tt.apiGroupSuffix) require.Equal(t, tt.want, scheme.AllKnownTypes()) diff --git a/internal/concierge/server/server_test.go b/internal/concierge/server/server_test.go index 0825cf5ba..70512a45c 100644 --- a/internal/concierge/server/server_test.go +++ b/internal/concierge/server/server_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package server @@ -67,7 +67,6 @@ func TestCommand(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { stdout := bytes.NewBuffer([]byte{}) stderr := bytes.NewBuffer([]byte{}) diff --git a/internal/config/concierge/config_test.go b/internal/config/concierge/config_test.go index ec7573941..f1d52c3ed 100644 --- a/internal/config/concierge/config_test.go +++ b/internal/config/concierge/config_test.go @@ -589,7 +589,6 @@ func TestFromPath(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { // this is a serial test because it sets the global logger diff --git a/internal/config/supervisor/config_test.go b/internal/config/supervisor/config_test.go index 61834a0eb..61f83aed8 100644 --- a/internal/config/supervisor/config_test.go +++ b/internal/config/supervisor/config_test.go @@ -253,7 +253,6 @@ func TestFromPath(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { // this is a serial test because it sets the global logger diff --git a/internal/controller/apicerts/certs_expirer_test.go b/internal/controller/apicerts/certs_expirer_test.go index eb88190fb..4dbaa6eda 100644 --- a/internal/controller/apicerts/certs_expirer_test.go +++ b/internal/controller/apicerts/certs_expirer_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package apicerts @@ -88,7 +88,6 @@ func TestExpirerControllerFilters(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name+"-"+test.namespace, func(t *testing.T) { t.Parallel() @@ -110,10 +109,10 @@ func TestExpirerControllerFilters(t *testing.T) { unrelated := corev1.Secret{} filter := withInformer.GetFilterForInformer(secretsInformer) - require.Equal(t, test.want, filter.Add(&test.secret)) - require.Equal(t, test.want, filter.Update(&unrelated, &test.secret)) - require.Equal(t, test.want, filter.Update(&test.secret, &unrelated)) - require.Equal(t, test.want, filter.Delete(&test.secret)) + require.Equal(t, test.want, filter.Add(test.secret.DeepCopy())) + require.Equal(t, test.want, filter.Update(&unrelated, test.secret.DeepCopy())) + require.Equal(t, test.want, filter.Update(test.secret.DeepCopy(), &unrelated)) + require.Equal(t, test.want, filter.Delete(test.secret.DeepCopy())) }) } } @@ -219,7 +218,6 @@ func TestExpirerControllerSync(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/internal/controller/apicerts/update_api_service_test.go b/internal/controller/apicerts/update_api_service_test.go index 9d7bce4d8..725f735e9 100644 --- a/internal/controller/apicerts/update_api_service_test.go +++ b/internal/controller/apicerts/update_api_service_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package apicerts @@ -203,7 +203,6 @@ func TestUpdateAPIService(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { ctx := context.Background() diff --git a/internal/controller/authenticator/cachecleaner/cachecleaner_test.go b/internal/controller/authenticator/cachecleaner/cachecleaner_test.go index 9602f05f8..72636b8f7 100644 --- a/internal/controller/authenticator/cachecleaner/cachecleaner_test.go +++ b/internal/controller/authenticator/cachecleaner/cachecleaner_test.go @@ -133,7 +133,6 @@ func TestController(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { // When we have t.Parallel() here, this test blocks pretty consistently...y tho? diff --git a/internal/controller/authenticator/jwtcachefiller/jwtcachefiller_test.go b/internal/controller/authenticator/jwtcachefiller/jwtcachefiller_test.go index 3777051eb..d934f08b8 100644 --- a/internal/controller/authenticator/jwtcachefiller/jwtcachefiller_test.go +++ b/internal/controller/authenticator/jwtcachefiller/jwtcachefiller_test.go @@ -1663,7 +1663,6 @@ func TestController(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -1781,7 +1780,6 @@ func TestController(t *testing.T) { tt.wantGroupsClaim, goodIssuer, ) { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/internal/controller/authenticator/webhookcachefiller/webhookcachefiller_test.go b/internal/controller/authenticator/webhookcachefiller/webhookcachefiller_test.go index a846c9577..2c8564670 100644 --- a/internal/controller/authenticator/webhookcachefiller/webhookcachefiller_test.go +++ b/internal/controller/authenticator/webhookcachefiller/webhookcachefiller_test.go @@ -1306,7 +1306,6 @@ func TestController(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -1465,7 +1464,6 @@ func TestNewWebhookAuthenticator(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() var conditions []*metav1.Condition diff --git a/internal/controller/issuerconfig/issuerconfig_test.go b/internal/controller/issuerconfig/issuerconfig_test.go index 1ef1600d9..7b4fef97f 100644 --- a/internal/controller/issuerconfig/issuerconfig_test.go +++ b/internal/controller/issuerconfig/issuerconfig_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package issuerconfig @@ -213,11 +213,10 @@ func TestMergeStrategy(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { updated := tt.configToUpdate.DeepCopy() mergeStrategy(updated, tt.strategy) - require.Equal(t, &tt.expected, updated) + require.Equal(t, tt.expected.DeepCopy(), updated) }) } } diff --git a/internal/controller/kubecertagent/kubecertagent.go b/internal/controller/kubecertagent/kubecertagent.go index 4e801719c..7afcdc147 100644 --- a/internal/controller/kubecertagent/kubecertagent.go +++ b/internal/controller/kubecertagent/kubecertagent.go @@ -626,7 +626,6 @@ func pluralize(pods []*corev1.Pod) string { func firstErr(errs ...error) error { for _, err := range errs { - err := err if err != nil { return err } diff --git a/internal/controller/kubecertagent/kubecertagent_test.go b/internal/controller/kubecertagent/kubecertagent_test.go index 564c11c97..1308e12a8 100644 --- a/internal/controller/kubecertagent/kubecertagent_test.go +++ b/internal/controller/kubecertagent/kubecertagent_test.go @@ -1018,7 +1018,6 @@ func TestAgentController(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -1177,15 +1176,14 @@ func TestMergeLabelsAndAnnotations(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() existingCopy := tt.existing.DeepCopy() desiredCopy := tt.desired.DeepCopy() got := mergeLabelsAndAnnotations(tt.existing, tt.desired) require.Equal(t, tt.expected, got) - require.Equal(t, existingCopy, &tt.existing, "input was modified!") - require.Equal(t, desiredCopy, &tt.desired, "input was modified!") + require.Equal(t, existingCopy, tt.existing.DeepCopy(), "input was modified!") + require.Equal(t, desiredCopy, tt.desired.DeepCopy(), "input was modified!") }) } } diff --git a/internal/controller/kubecertagent/legacypodcleaner_test.go b/internal/controller/kubecertagent/legacypodcleaner_test.go index 211219af7..843c2398e 100644 --- a/internal/controller/kubecertagent/legacypodcleaner_test.go +++ b/internal/controller/kubecertagent/legacypodcleaner_test.go @@ -1,4 +1,4 @@ -// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package kubecertagent @@ -139,7 +139,6 @@ func TestLegacyPodCleanerController(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/controller/serviceaccounttokencleanup/legacy_service_account_token_cleanup_controller_test.go b/internal/controller/serviceaccounttokencleanup/legacy_service_account_token_cleanup_controller_test.go index 364393dab..2629ac87c 100644 --- a/internal/controller/serviceaccounttokencleanup/legacy_service_account_token_cleanup_controller_test.go +++ b/internal/controller/serviceaccounttokencleanup/legacy_service_account_token_cleanup_controller_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2023-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package serviceaccounttokencleanup @@ -130,7 +130,6 @@ func TestSync(t *testing.T) { }, }, } { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/controller/supervisorconfig/activedirectoryupstreamwatcher/active_directory_upstream_watcher_test.go b/internal/controller/supervisorconfig/activedirectoryupstreamwatcher/active_directory_upstream_watcher_test.go index d6f1ee08b..ed12e87d4 100644 --- a/internal/controller/supervisorconfig/activedirectoryupstreamwatcher/active_directory_upstream_watcher_test.go +++ b/internal/controller/supervisorconfig/activedirectoryupstreamwatcher/active_directory_upstream_watcher_test.go @@ -71,7 +71,6 @@ func TestActiveDirectoryUpstreamWatcherControllerFilterSecrets(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -116,7 +115,6 @@ func TestActiveDirectoryUpstreamWatcherControllerFilterActiveDirectoryIdentityPr }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -2002,7 +2000,6 @@ func TestActiveDirectoryUpstreamWatcherControllerSync(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/controller/supervisorconfig/federation_domain_watcher_test.go b/internal/controller/supervisorconfig/federation_domain_watcher_test.go index 1f8876a6f..ade25e060 100644 --- a/internal/controller/supervisorconfig/federation_domain_watcher_test.go +++ b/internal/controller/supervisorconfig/federation_domain_watcher_test.go @@ -85,7 +85,6 @@ func TestFederationDomainWatcherControllerInformerFilters(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -1999,7 +1998,6 @@ func TestTestFederationDomainWatcherControllerSync(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/controller/supervisorconfig/generator/federation_domain_secrets_test.go b/internal/controller/supervisorconfig/generator/federation_domain_secrets_test.go index e0d371ac4..18940f0e9 100644 --- a/internal/controller/supervisorconfig/generator/federation_domain_secrets_test.go +++ b/internal/controller/supervisorconfig/generator/federation_domain_secrets_test.go @@ -168,7 +168,6 @@ func TestFederationDomainControllerFilterSecret(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -231,7 +230,6 @@ func TestNewFederationDomainSecretsControllerFilterFederationDomain(t *testing.T }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -264,11 +262,11 @@ func TestNewFederationDomainSecretsControllerFilterFederationDomain(t *testing.T unrelated := configv1alpha1.FederationDomain{} filter := withInformer.GetFilterForInformer(federationDomainInformer) - require.Equal(t, test.wantAdd, filter.Add(&test.federationDomain)) - require.Equal(t, test.wantUpdate, filter.Update(&unrelated, &test.federationDomain)) - require.Equal(t, test.wantUpdate, filter.Update(&test.federationDomain, &unrelated)) - require.Equal(t, test.wantDelete, filter.Delete(&test.federationDomain)) - require.Equal(t, test.wantParent, filter.Parent(&test.federationDomain)) + require.Equal(t, test.wantAdd, filter.Add(test.federationDomain.DeepCopy())) + require.Equal(t, test.wantUpdate, filter.Update(&unrelated, test.federationDomain.DeepCopy())) + require.Equal(t, test.wantUpdate, filter.Update(test.federationDomain.DeepCopy(), &unrelated)) + require.Equal(t, test.wantDelete, filter.Delete(test.federationDomain.DeepCopy())) + require.Equal(t, test.wantParent, filter.Parent(test.federationDomain.DeepCopy())) }) } } @@ -625,7 +623,6 @@ func TestFederationDomainSecretsControllerSync(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/internal/controller/supervisorconfig/generator/secret_helper_test.go b/internal/controller/supervisorconfig/generator/secret_helper_test.go index cd03efba1..7750ad4b5 100644 --- a/internal/controller/supervisorconfig/generator/secret_helper_test.go +++ b/internal/controller/supervisorconfig/generator/secret_helper_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package generator @@ -52,7 +52,6 @@ func TestSymmetricSecretHelper(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -182,7 +181,6 @@ func TestSymmetricSecretHelperIsValid(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { h := NewSymmetricSecretHelper("none of these args matter", nil, nil, test.secretUsage, nil) diff --git a/internal/controller/supervisorconfig/generator/supervisor_secrets_test.go b/internal/controller/supervisorconfig/generator/supervisor_secrets_test.go index 594fe5c7e..1ac1e9473 100644 --- a/internal/controller/supervisorconfig/generator/supervisor_secrets_test.go +++ b/internal/controller/supervisorconfig/generator/supervisor_secrets_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package generator @@ -100,7 +100,6 @@ func TestSupervisorSecretsControllerFilterSecret(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -407,7 +406,6 @@ func TestSupervisorSecretsControllerSync(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { // We cannot currently run this test in parallel since it uses the global generateKey function. diff --git a/internal/controller/supervisorconfig/jwks_writer_test.go b/internal/controller/supervisorconfig/jwks_writer_test.go index bfb09ba50..0f395f01c 100644 --- a/internal/controller/supervisorconfig/jwks_writer_test.go +++ b/internal/controller/supervisorconfig/jwks_writer_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package supervisorconfig @@ -167,7 +167,6 @@ func TestJWKSWriterControllerFilterSecret(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -221,7 +220,6 @@ func TestJWKSWriterControllerFilterFederationDomain(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -245,11 +243,11 @@ func TestJWKSWriterControllerFilterFederationDomain(t *testing.T) { unrelated := configv1alpha1.FederationDomain{} filter := withInformer.GetFilterForInformer(federationDomainInformer) - require.Equal(t, test.wantAdd, filter.Add(&test.federationDomain)) - require.Equal(t, test.wantUpdate, filter.Update(&unrelated, &test.federationDomain)) - require.Equal(t, test.wantUpdate, filter.Update(&test.federationDomain, &unrelated)) - require.Equal(t, test.wantDelete, filter.Delete(&test.federationDomain)) - require.Equal(t, test.wantParent, filter.Parent(&test.federationDomain)) + require.Equal(t, test.wantAdd, filter.Add(test.federationDomain.DeepCopy())) + require.Equal(t, test.wantUpdate, filter.Update(&unrelated, test.federationDomain.DeepCopy())) + require.Equal(t, test.wantUpdate, filter.Update(test.federationDomain.DeepCopy(), &unrelated)) + require.Equal(t, test.wantDelete, filter.Delete(test.federationDomain.DeepCopy())) + require.Equal(t, test.wantParent, filter.Parent(test.federationDomain.DeepCopy())) }) } } @@ -664,7 +662,6 @@ func TestJWKSWriterControllerSync(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { // We shouldn't run this test in parallel since it messes with a global function (generateKey). generateKeyCount := 0 diff --git a/internal/controller/supervisorconfig/ldapupstreamwatcher/ldap_upstream_watcher_test.go b/internal/controller/supervisorconfig/ldapupstreamwatcher/ldap_upstream_watcher_test.go index 38fdf94d7..1e871858a 100644 --- a/internal/controller/supervisorconfig/ldapupstreamwatcher/ldap_upstream_watcher_test.go +++ b/internal/controller/supervisorconfig/ldapupstreamwatcher/ldap_upstream_watcher_test.go @@ -70,7 +70,6 @@ func TestLDAPUpstreamWatcherControllerFilterSecrets(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -115,7 +114,6 @@ func TestLDAPUpstreamWatcherControllerFilterLDAPIdentityProviders(t *testing.T) }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -1131,7 +1129,6 @@ func TestLDAPUpstreamWatcherControllerSync(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/controller/supervisorconfig/oidcclientwatcher/oidc_client_watcher_test.go b/internal/controller/supervisorconfig/oidcclientwatcher/oidc_client_watcher_test.go index a62497e3e..d13bad387 100644 --- a/internal/controller/supervisorconfig/oidcclientwatcher/oidc_client_watcher_test.go +++ b/internal/controller/supervisorconfig/oidcclientwatcher/oidc_client_watcher_test.go @@ -1,4 +1,4 @@ -// Copyright 2022-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2022-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package oidcclientwatcher @@ -954,7 +954,6 @@ func TestOIDCClientWatcherControllerSync(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() fakePinnipedClient := pinnipedfake.NewSimpleClientset(tt.inputObjects...) diff --git a/internal/controller/supervisorconfig/oidcupstreamwatcher/oidc_upstream_watcher_test.go b/internal/controller/supervisorconfig/oidcupstreamwatcher/oidc_upstream_watcher_test.go index 6837fa62a..614ee3afd 100644 --- a/internal/controller/supervisorconfig/oidcupstreamwatcher/oidc_upstream_watcher_test.go +++ b/internal/controller/supervisorconfig/oidcupstreamwatcher/oidc_upstream_watcher_test.go @@ -74,7 +74,6 @@ func TestOIDCUpstreamWatcherControllerFilterSecret(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -1409,7 +1408,6 @@ oidc: issuer did not match the issuer returned by provider, expected "` + testIs }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() fakePinnipedClient := pinnipedfake.NewSimpleClientset(tt.inputUpstreams...) diff --git a/internal/controllerinit/controllerinit.go b/internal/controllerinit/controllerinit.go index 125974669..825817e49 100644 --- a/internal/controllerinit/controllerinit.go +++ b/internal/controllerinit/controllerinit.go @@ -1,4 +1,4 @@ -// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package controllerinit @@ -34,8 +34,6 @@ type Informer interface { func Prepare(controllers Runner, controllersWrapper RunnerWrapper, informers ...Informer) RunnerBuilder { return func(ctx context.Context) (Runner, error) { for _, informer := range informers { - informer := informer - informer.Start(ctx.Done()) // prevent us from blocking forever due to a broken informer diff --git a/internal/controllerlib/test/integration/examplecontroller/controller/creating_test.go b/internal/controllerlib/test/integration/examplecontroller/controller/creating_test.go index 74c617219..1d3100848 100644 --- a/internal/controllerlib/test/integration/examplecontroller/controller/creating_test.go +++ b/internal/controllerlib/test/integration/examplecontroller/controller/creating_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package controller @@ -92,8 +92,6 @@ func TestNewExampleCreatingController(t *testing.T) { }, } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { kubeClient := fake.NewSimpleClientset() for i := range tt.args.services { diff --git a/internal/crud/crud_test.go b/internal/crud/crud_test.go index ea9d8c369..1a54e6d3d 100644 --- a/internal/crud/crud_test.go +++ b/internal/crud/crud_test.go @@ -1288,7 +1288,6 @@ func TestStorage(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -1516,7 +1515,6 @@ func TestFromSecret(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() data := &testJSON{} diff --git a/internal/crypto/ptls/ptls.go b/internal/crypto/ptls/ptls.go index 52a3d3ea5..bf2ae4e1f 100644 --- a/internal/crypto/ptls/ptls.go +++ b/internal/crypto/ptls/ptls.go @@ -38,7 +38,6 @@ func Legacy(rootCAs *x509.CertPool) *tls.Config { func suitesToIDs(suites []*tls.CipherSuite) []uint16 { out := make([]uint16, 0, len(suites)) for _, suite := range suites { - suite := suite out = append(out, suite.ID) } return out diff --git a/internal/crypto/ptls/ptls_test.go b/internal/crypto/ptls/ptls_test.go index 5825faf1d..789b30fbf 100644 --- a/internal/crypto/ptls/ptls_test.go +++ b/internal/crypto/ptls/ptls_test.go @@ -208,7 +208,6 @@ func TestMerge(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/deploymentref/deploymentref_test.go b/internal/deploymentref/deploymentref_test.go index 181e3f11b..e219ecd10 100644 --- a/internal/deploymentref/deploymentref_test.go +++ b/internal/deploymentref/deploymentref_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package deploymentref @@ -106,7 +106,6 @@ func TestNew(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { client := kubefake.NewSimpleClientset(test.apiObjects...) if test.client != nil { diff --git a/internal/downward/downward_test.go b/internal/downward/downward_test.go index adc15b407..efaa7ec56 100644 --- a/internal/downward/downward_test.go +++ b/internal/downward/downward_test.go @@ -1,4 +1,4 @@ -// Copyright 2020 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package downward @@ -51,7 +51,6 @@ func TestLoad(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { got, err := Load(tt.inputDir) if tt.wantErr != "" { @@ -103,7 +102,6 @@ example.com/bar="baz\x01" }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { got, err := parseMap(tt.input) if tt.wantErr != "" { diff --git a/internal/dynamiccert/provider_test.go b/internal/dynamiccert/provider_test.go index 9dc05b709..3c661d963 100644 --- a/internal/dynamiccert/provider_test.go +++ b/internal/dynamiccert/provider_test.go @@ -1,4 +1,4 @@ -// Copyright 2021-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package dynamiccert @@ -148,7 +148,6 @@ func TestProviderWithDynamicServingCertificateController(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/endpointaddr/endpointaddr_test.go b/internal/endpointaddr/endpointaddr_test.go index 91c68b0d6..1d560629d 100644 --- a/internal/endpointaddr/endpointaddr_test.go +++ b/internal/endpointaddr/endpointaddr_test.go @@ -174,7 +174,6 @@ func TestParse(t *testing.T) { expectErr: `host "host.example.com:port1:port2" is not a valid hostname or IP address`, }, } { - tt := tt t.Run(tt.name, func(t *testing.T) { got, err := Parse(tt.input, tt.defaultPort) if tt.expectErr == "" { @@ -338,7 +337,6 @@ func TestParseFromURL(t *testing.T) { expectErr: `address [::1]]:443: missing port in address`, }, } { - tt := tt t.Run(tt.name, func(t *testing.T) { urlToProcess, err := url.Parse(tt.input) require.NoError(t, err, "ParseFromURL expects a valid url.URL, parse errors here are not valuable") diff --git a/internal/execcredcache/cachefile_test.go b/internal/execcredcache/cachefile_test.go index c4c719486..1c42d5179 100644 --- a/internal/execcredcache/cachefile_test.go +++ b/internal/execcredcache/cachefile_test.go @@ -1,4 +1,4 @@ -// Copyright 2021-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package execcredcache @@ -70,7 +70,6 @@ func TestReadCache(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() got, err := readCache(tt.path) diff --git a/internal/execcredcache/execcredcache_test.go b/internal/execcredcache/execcredcache_test.go index 1b92a5b87..d7831ac8e 100644 --- a/internal/execcredcache/execcredcache_test.go +++ b/internal/execcredcache/execcredcache_test.go @@ -1,4 +1,4 @@ -// Copyright 2021-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package execcredcache @@ -162,7 +162,6 @@ func TestGet(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() tmp := t.TempDir() + "/sessions.yaml" @@ -328,7 +327,6 @@ func TestPutToken(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() tmp := t.TempDir() + "/cachedir/credentials.yaml" diff --git a/internal/federationdomain/clientregistry/clientregistry_test.go b/internal/federationdomain/clientregistry/clientregistry_test.go index cc1b0dc6e..1d8f20612 100644 --- a/internal/federationdomain/clientregistry/clientregistry_test.go +++ b/internal/federationdomain/clientregistry/clientregistry_test.go @@ -253,8 +253,6 @@ func TestClientManager(t *testing.T) { } for _, test := range tests { - test := test - t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/internal/federationdomain/downstreamsubject/downstream_subject_test.go b/internal/federationdomain/downstreamsubject/downstream_subject_test.go index 703624e94..b96ec85ad 100644 --- a/internal/federationdomain/downstreamsubject/downstream_subject_test.go +++ b/internal/federationdomain/downstreamsubject/downstream_subject_test.go @@ -42,7 +42,6 @@ func TestLDAP(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -81,7 +80,6 @@ func TestOIDC(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/internal/federationdomain/dynamiccodec/codec_test.go b/internal/federationdomain/dynamiccodec/codec_test.go index d6c85357a..b5380b4b1 100644 --- a/internal/federationdomain/dynamiccodec/codec_test.go +++ b/internal/federationdomain/dynamiccodec/codec_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package dynamiccodec @@ -78,7 +78,6 @@ func TestCodec(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { var ( encoderSigningKey = []byte("some-signing-key") diff --git a/internal/federationdomain/endpoints/auth/auth_handler_test.go b/internal/federationdomain/endpoints/auth/auth_handler_test.go index 52cd06b29..81918abc8 100644 --- a/internal/federationdomain/endpoints/auth/auth_handler_test.go +++ b/internal/federationdomain/endpoints/auth/auth_handler_test.go @@ -3536,7 +3536,6 @@ func TestAuthorizationEndpoint(t *testing.T) { //nolint:gocyclo } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { kubeClient := fake.NewSimpleClientset() supervisorClient := supervisorfake.NewSimpleClientset() diff --git a/internal/federationdomain/endpoints/callback/callback_handler_test.go b/internal/federationdomain/endpoints/callback/callback_handler_test.go index 433365b9c..d0aa3a6b8 100644 --- a/internal/federationdomain/endpoints/callback/callback_handler_test.go +++ b/internal/federationdomain/endpoints/callback/callback_handler_test.go @@ -1529,8 +1529,6 @@ func TestCallbackEndpoint(t *testing.T) { } for _, test := range tests { - test := test - t.Run(test.name, func(t *testing.T) { kubeClient := fake.NewSimpleClientset() supervisorClient := supervisorfake.NewSimpleClientset() diff --git a/internal/federationdomain/endpoints/chooseidp/choose_idp_handler_test.go b/internal/federationdomain/endpoints/chooseidp/choose_idp_handler_test.go index 9ef356afa..de6b687e0 100644 --- a/internal/federationdomain/endpoints/chooseidp/choose_idp_handler_test.go +++ b/internal/federationdomain/endpoints/chooseidp/choose_idp_handler_test.go @@ -132,7 +132,6 @@ func TestChooseIDPHandler(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/internal/federationdomain/endpoints/discovery/discovery_handler_test.go b/internal/federationdomain/endpoints/discovery/discovery_handler_test.go index cd205974e..4092aced0 100644 --- a/internal/federationdomain/endpoints/discovery/discovery_handler_test.go +++ b/internal/federationdomain/endpoints/discovery/discovery_handler_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package discovery @@ -65,7 +65,6 @@ func TestDiscovery(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { handler := NewHandler(test.issuer) req := httptest.NewRequest(test.method, test.path, nil) diff --git a/internal/federationdomain/endpoints/idpdiscovery/idp_discovery_handler_test.go b/internal/federationdomain/endpoints/idpdiscovery/idp_discovery_handler_test.go index 892a1dc84..63bd18bbf 100644 --- a/internal/federationdomain/endpoints/idpdiscovery/idp_discovery_handler_test.go +++ b/internal/federationdomain/endpoints/idpdiscovery/idp_discovery_handler_test.go @@ -68,7 +68,6 @@ func TestIDPDiscovery(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { idpLister := testidplister.NewUpstreamIDPListerBuilder(). WithOIDC(oidctestutil.NewTestUpstreamOIDCIdentityProviderBuilder().WithName("z-some-oidc-idp").WithAllowPasswordGrant(true).Build()). diff --git a/internal/federationdomain/endpoints/jwks/jwks_handler_test.go b/internal/federationdomain/endpoints/jwks/jwks_handler_test.go index 1c630e5d7..12463b376 100644 --- a/internal/federationdomain/endpoints/jwks/jwks_handler_test.go +++ b/internal/federationdomain/endpoints/jwks/jwks_handler_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package jwks @@ -77,7 +77,6 @@ func TestJWKSEndpoint(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { handler := NewHandler(test.issuer, test.provider) req := httptest.NewRequest(test.method, test.path, nil) diff --git a/internal/federationdomain/endpoints/token/token_handler_test.go b/internal/federationdomain/endpoints/token/token_handler_test.go index e33fee2d1..799990fdd 100644 --- a/internal/federationdomain/endpoints/token/token_handler_test.go +++ b/internal/federationdomain/endpoints/token/token_handler_test.go @@ -927,7 +927,6 @@ func TestTokenEndpointAuthcodeExchange(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -961,7 +960,6 @@ func TestTokenEndpointWhenAuthcodeIsUsedTwice(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -1641,7 +1639,6 @@ func TestTokenEndpointTokenExchange(t *testing.T) { // tests for grant_type "urn }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -4524,7 +4521,6 @@ func TestRefreshGrant(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -5473,7 +5469,6 @@ func TestDiffSortedGroups(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/internal/federationdomain/federationdomainproviders/federation_domain_identity_providers_lister_finder_test.go b/internal/federationdomain/federationdomainproviders/federation_domain_identity_providers_lister_finder_test.go index 7e4d7a5b9..f220b9108 100644 --- a/internal/federationdomain/federationdomainproviders/federation_domain_identity_providers_lister_finder_test.go +++ b/internal/federationdomain/federationdomainproviders/federation_domain_identity_providers_lister_finder_test.go @@ -248,7 +248,6 @@ func TestFederationDomainIdentityProvidersListerFinder(t *testing.T) { } for _, tt := range testFindUpstreamIDPByDisplayName { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -324,7 +323,6 @@ func TestFederationDomainIdentityProvidersListerFinder(t *testing.T) { } for _, tt := range testFindDefaultIDP { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -399,7 +397,6 @@ func TestFederationDomainIdentityProvidersListerFinder(t *testing.T) { } for _, tt := range testGetIdentityProviders { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -450,7 +447,6 @@ func TestFederationDomainIdentityProvidersListerFinder(t *testing.T) { } for _, tt := range testIDPCount { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -503,7 +499,6 @@ func TestFederationDomainIdentityProvidersListerFinder(t *testing.T) { } for _, tt := range testHasDefaultIDP { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/federationdomain/federationdomainproviders/federation_domain_issuer_test.go b/internal/federationdomain/federationdomainproviders/federation_domain_issuer_test.go index 34125d746..05967dca0 100644 --- a/internal/federationdomain/federationdomainproviders/federation_domain_issuer_test.go +++ b/internal/federationdomain/federationdomainproviders/federation_domain_issuer_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package federationdomainproviders @@ -83,7 +83,6 @@ func TestFederationDomainIssuerValidations(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { _, err := NewFederationDomainIssuer(tt.issuer, []*FederationDomainIdentityProvider{}) if tt.wantError != "" { diff --git a/internal/federationdomain/idtokenlifespan/idtoken_lifespan_test.go b/internal/federationdomain/idtokenlifespan/idtoken_lifespan_test.go index 0501525a0..6989bc37d 100644 --- a/internal/federationdomain/idtokenlifespan/idtoken_lifespan_test.go +++ b/internal/federationdomain/idtokenlifespan/idtoken_lifespan_test.go @@ -54,7 +54,6 @@ func TestOverrideIDTokenLifespanInContext(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/federationdomain/oidc/oidc_test.go b/internal/federationdomain/oidc/oidc_test.go index c629dfcc0..6c8e55d01 100644 --- a/internal/federationdomain/oidc/oidc_test.go +++ b/internal/federationdomain/oidc/oidc_test.go @@ -103,7 +103,6 @@ func TestOverrideIDTokenLifespan(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/federationdomain/resolvedprovider/resolvedoidc/resolved_oidc_provider_test.go b/internal/federationdomain/resolvedprovider/resolvedoidc/resolved_oidc_provider_test.go index 25c2c565a..2ab0654b6 100644 --- a/internal/federationdomain/resolvedprovider/resolvedoidc/resolved_oidc_provider_test.go +++ b/internal/federationdomain/resolvedprovider/resolvedoidc/resolved_oidc_provider_test.go @@ -57,7 +57,6 @@ func TestMapAdditionalClaimsFromUpstreamIDToken(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/internal/federationdomain/strategy/dynamic_oauth2_hmac_strategy_test.go b/internal/federationdomain/strategy/dynamic_oauth2_hmac_strategy_test.go index 02bf861c3..c548553c2 100644 --- a/internal/federationdomain/strategy/dynamic_oauth2_hmac_strategy_test.go +++ b/internal/federationdomain/strategy/dynamic_oauth2_hmac_strategy_test.go @@ -1,4 +1,4 @@ -// Copyright 2022-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2022-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package strategy @@ -47,7 +47,6 @@ func TestDynamicOauth2HMACStrategy_Signatures(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -94,7 +93,6 @@ func TestDynamicOauth2HMACStrategy_Generate(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -166,7 +164,6 @@ func TestDynamicOauth2HMACStrategy_Validate(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/federationdomain/strategy/dynamic_open_id_connect_ecdsa_strategy_test.go b/internal/federationdomain/strategy/dynamic_open_id_connect_ecdsa_strategy_test.go index 74d548668..0fe8ea733 100644 --- a/internal/federationdomain/strategy/dynamic_open_id_connect_ecdsa_strategy_test.go +++ b/internal/federationdomain/strategy/dynamic_open_id_connect_ecdsa_strategy_test.go @@ -88,7 +88,6 @@ func TestDynamicOpenIDConnectECDSAStrategy(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { jwksProvider := jwks.NewDynamicJWKSProvider() if test.jwksProvider != nil { diff --git a/internal/fositestorage/accesstoken/accesstoken_test.go b/internal/fositestorage/accesstoken/accesstoken_test.go index 522c24c90..2091fc175 100644 --- a/internal/fositestorage/accesstoken/accesstoken_test.go +++ b/internal/fositestorage/accesstoken/accesstoken_test.go @@ -408,7 +408,6 @@ func TestReadFromSecret(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() session, err := ReadFromSecret(tt.secret) diff --git a/internal/fositestorage/authorizationcode/authorizationcode_test.go b/internal/fositestorage/authorizationcode/authorizationcode_test.go index a95d0e970..f39e5580a 100644 --- a/internal/fositestorage/authorizationcode/authorizationcode_test.go +++ b/internal/fositestorage/authorizationcode/authorizationcode_test.go @@ -544,7 +544,6 @@ func TestReadFromSecret(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() session, err := ReadFromSecret(tt.secret) diff --git a/internal/fositestorage/refreshtoken/refreshtoken_test.go b/internal/fositestorage/refreshtoken/refreshtoken_test.go index 6075d0723..dc369a15b 100644 --- a/internal/fositestorage/refreshtoken/refreshtoken_test.go +++ b/internal/fositestorage/refreshtoken/refreshtoken_test.go @@ -465,7 +465,6 @@ func TestReadFromSecret(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() session, err := ReadFromSecret(tt.secret) diff --git a/internal/groupsuffix/groupsuffix.go b/internal/groupsuffix/groupsuffix.go index cb1927c81..b2d3ccdd5 100644 --- a/internal/groupsuffix/groupsuffix.go +++ b/internal/groupsuffix/groupsuffix.go @@ -1,4 +1,4 @@ -// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package groupsuffix @@ -186,7 +186,6 @@ func Validate(apiGroupSuffix string) error { errorStrings := validation.IsDNS1123Subdomain(apiGroupSuffix) for _, errorString := range errorStrings { - errorString := errorString errs = append(errs, constable.Error(errorString)) } diff --git a/internal/groupsuffix/groupsuffix_test.go b/internal/groupsuffix/groupsuffix_test.go index 3afcd82eb..bf7f3af4d 100644 --- a/internal/groupsuffix/groupsuffix_test.go +++ b/internal/groupsuffix/groupsuffix_test.go @@ -1,4 +1,4 @@ -// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package groupsuffix @@ -525,7 +525,6 @@ func TestMiddlware(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { m := New(test.apiGroupSuffix) if test.wantNilMiddleware { @@ -542,7 +541,6 @@ func TestMiddlware(t *testing.T) { objMutated := test.requestObj.DeepCopyObject().(kubeclient.Object) var mutateRequestErrors []string for _, mutateRequest := range test.rt.MutateRequests { - mutateRequest := mutateRequest if err := mutateRequest(objMutated); err != nil { mutateRequestErrors = append(mutateRequestErrors, err.Error()) } @@ -559,7 +557,6 @@ func TestMiddlware(t *testing.T) { objMutated := test.responseObj.DeepCopyObject().(kubeclient.Object) var mutateResponseErrors []string for _, mutateResponse := range test.rt.MutateResponses { - mutateResponse := mutateResponse if err := mutateResponse(objMutated); err != nil { mutateResponseErrors = append(mutateResponseErrors, err.Error()) } @@ -637,7 +634,6 @@ func TestValidate(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.apiGroupSuffix, func(t *testing.T) { err := Validate(test.apiGroupSuffix) if test.wantErrorPrefix != "" { diff --git a/internal/httputil/securityheader/securityheader_test.go b/internal/httputil/securityheader/securityheader_test.go index 6181acc50..d08b2f093 100644 --- a/internal/httputil/securityheader/securityheader_test.go +++ b/internal/httputil/securityheader/securityheader_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package securityheader @@ -56,7 +56,6 @@ func TestWrap(t *testing.T) { }, }, } { - tt := tt t.Run(tt.name, func(t *testing.T) { testServer := httptest.NewServer(tt.wrapFunc(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("X-Test-Header", "test value") diff --git a/internal/idtransform/identity_transformations_test.go b/internal/idtransform/identity_transformations_test.go index 59ed78c82..e1db0a321 100644 --- a/internal/idtransform/identity_transformations_test.go +++ b/internal/idtransform/identity_transformations_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2023-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package idtransform @@ -297,7 +297,6 @@ func TestTransformationPipelineEvaluation(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/kubeclient/gvk_test.go b/internal/kubeclient/gvk_test.go index cf0f711c5..6a590501e 100644 --- a/internal/kubeclient/gvk_test.go +++ b/internal/kubeclient/gvk_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package kubeclient @@ -172,7 +172,6 @@ func Test_maybeRestoreGVK(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { serializer := &testSerializer{unknown: tt.args.unknown} respData := []byte(`original`) diff --git a/internal/kubeclient/kubeclient_test.go b/internal/kubeclient/kubeclient_test.go index a4e95313f..c16c9d8fb 100644 --- a/internal/kubeclient/kubeclient_test.go +++ b/internal/kubeclient/kubeclient_test.go @@ -602,7 +602,6 @@ func TestKubeclient(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { _, restConfig := fakekubeapi.Start(t, nil) @@ -1134,7 +1133,6 @@ func testUnwrap(t *testing.T, client *Client, serverSubjects [][]byte, tlsConfig }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() // make sure to run in parallel to confirm that our client-go TLS cache busting works (i.e. assert no data races) diff --git a/internal/kubeclient/middleware.go b/internal/kubeclient/middleware.go index 15760592d..4c5aa3226 100644 --- a/internal/kubeclient/middleware.go +++ b/internal/kubeclient/middleware.go @@ -1,4 +1,4 @@ -// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package kubeclient @@ -33,7 +33,6 @@ type Middlewares []Middleware func (m Middlewares) Handle(ctx context.Context, rt RoundTrip) { for _, middleware := range m { - middleware := middleware middleware.Handle(ctx, rt) } } @@ -116,7 +115,6 @@ func (r *request) mutateRequest(obj Object) (*mutationResult, error) { var errs []error for _, reqFunc := range r.reqFuncs { - reqFunc := reqFunc if err := reqFunc(obj); err != nil { errs = append(errs, err) } @@ -146,7 +144,6 @@ func (r *request) mutateResponse(obj Object) (bool, error) { var errs []error for _, respFunc := range r.respFuncs { - respFunc := respFunc if err := respFunc(obj); err != nil { errs = append(errs, err) } diff --git a/internal/kubeclient/middleware_test.go b/internal/kubeclient/middleware_test.go index 583b3f746..3817a05a6 100644 --- a/internal/kubeclient/middleware_test.go +++ b/internal/kubeclient/middleware_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package kubeclient @@ -50,7 +50,6 @@ func Test_request_mutate(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { r := &request{reqFuncs: tt.reqFuncs} orig := tt.obj.DeepCopyObject() diff --git a/internal/kubeclient/path_test.go b/internal/kubeclient/path_test.go index db72a8684..a2e39200c 100644 --- a/internal/kubeclient/path_test.go +++ b/internal/kubeclient/path_test.go @@ -1,4 +1,4 @@ -// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package kubeclient @@ -127,7 +127,6 @@ func Test_updatePathNewGVK(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { got, err := updatePathNewGVK(tt.args.reqURL, tt.args.result, tt.args.apiPathPrefix, tt.args.reqInfo) if (err != nil) != tt.wantErr { @@ -213,7 +212,6 @@ func Test_reqWithoutPrefix(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { req := *tt.args.req if got := reqWithoutPrefix(&req, tt.args.hostURL, tt.args.apiPathPrefix); !reflect.DeepEqual(got, tt.want) { diff --git a/internal/kubeclient/roundtrip.go b/internal/kubeclient/roundtrip.go index b6f8decf5..e95c492aa 100644 --- a/internal/kubeclient/roundtrip.go +++ b/internal/kubeclient/roundtrip.go @@ -1,4 +1,4 @@ -// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package kubeclient @@ -98,7 +98,6 @@ func newWrapper( } for _, middleware := range middlewares { - middleware := middleware middleware.Handle(req.Context(), middlewareReq) } diff --git a/internal/kubeclient/scheme_test.go b/internal/kubeclient/scheme_test.go index 6e69026c2..314f352d6 100644 --- a/internal/kubeclient/scheme_test.go +++ b/internal/kubeclient/scheme_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package kubeclient @@ -139,7 +139,6 @@ func Test_schemeRestMapper(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { schemeRestMapperFunc := schemeRestMapper(tt.args.scheme) gvk, ok := schemeRestMapperFunc(tt.args.gvr, tt.args.v) diff --git a/internal/kubeclient/verb_test.go b/internal/kubeclient/verb_test.go index c9df4f898..2f726e8ba 100644 --- a/internal/kubeclient/verb_test.go +++ b/internal/kubeclient/verb_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package kubeclient @@ -46,7 +46,6 @@ func Test_verb(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { require.Equal(t, tt.want, tt.f()) }) diff --git a/internal/leaderelection/leaderelection_test.go b/internal/leaderelection/leaderelection_test.go index 33a69ec7e..8fb76f855 100644 --- a/internal/leaderelection/leaderelection_test.go +++ b/internal/leaderelection/leaderelection_test.go @@ -1,4 +1,4 @@ -// Copyright 2021-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package leaderelection @@ -58,7 +58,6 @@ func Test_releaseLock_Update(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/localuserauthenticator/localuserauthenticator_test.go b/internal/localuserauthenticator/localuserauthenticator_test.go index 8a5062675..da0df8c4b 100644 --- a/internal/localuserauthenticator/localuserauthenticator_test.go +++ b/internal/localuserauthenticator/localuserauthenticator_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package localuserauthenticator @@ -390,7 +390,6 @@ func TestWebhook(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { parsedURL, err := url.Parse(test.url) require.NoError(t, err) diff --git a/internal/net/phttp/debug_test.go b/internal/net/phttp/debug_test.go index fe5b12a02..1b0748235 100644 --- a/internal/net/phttp/debug_test.go +++ b/internal/net/phttp/debug_test.go @@ -1,4 +1,4 @@ -// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package phttp @@ -237,7 +237,6 @@ func Test_safeDebugWrappers_clean(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/net/phttp/phttp_test.go b/internal/net/phttp/phttp_test.go index 3a37983cf..e806fd627 100644 --- a/internal/net/phttp/phttp_test.go +++ b/internal/net/phttp/phttp_test.go @@ -38,7 +38,6 @@ func TestUnwrap(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -78,7 +77,6 @@ func TestClient(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/net/phttp/warning_test.go b/internal/net/phttp/warning_test.go index 4ca8a4487..2660fad6d 100644 --- a/internal/net/phttp/warning_test.go +++ b/internal/net/phttp/warning_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package phttp @@ -67,7 +67,6 @@ func Test_warningWrapper(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/oidcclientsecretstorage/oidcclientsecretstorage_test.go b/internal/oidcclientsecretstorage/oidcclientsecretstorage_test.go index f2b46db0d..aeb17fbb9 100644 --- a/internal/oidcclientsecretstorage/oidcclientsecretstorage_test.go +++ b/internal/oidcclientsecretstorage/oidcclientsecretstorage_test.go @@ -1,4 +1,4 @@ -// Copyright 2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2022-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package oidcclientsecretstorage @@ -115,7 +115,6 @@ func TestGet(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() kubeClient := fake.NewSimpleClientset() @@ -325,7 +324,6 @@ func TestSet(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() kubeClient := fake.NewSimpleClientset() @@ -389,7 +387,6 @@ func TestGetStorageSecret(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -523,7 +520,6 @@ func TestReadFromSecret(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() hashes, err := ReadFromSecret(tt.secret) diff --git a/internal/ownerref/ownerref_test.go b/internal/ownerref/ownerref_test.go index 7f98ff945..7b05b477a 100644 --- a/internal/ownerref/ownerref_test.go +++ b/internal/ownerref/ownerref_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package ownerref @@ -194,7 +194,6 @@ func TestOwnerReferenceMiddleware(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { middleware := New(tt.args.ref) @@ -212,7 +211,6 @@ func TestOwnerReferenceMiddleware(t *testing.T) { orig := tt.args.obj.DeepCopyObject().(kubeclient.Object) for _, mutateRequest := range rt.MutateRequests { - mutateRequest := mutateRequest require.NoError(t, mutateRequest(tt.args.obj)) } if !tt.wantMutates { diff --git a/internal/plog/config_test.go b/internal/plog/config_test.go index c5e750377..462610180 100644 --- a/internal/plog/config_test.go +++ b/internal/plog/config_test.go @@ -217,7 +217,6 @@ func TestValidateAndSetLogLevelGlobally(t *testing.T) { }, } for _, tt := range tests { - tt := tt // capture range variable t.Run(tt.name, func(t *testing.T) { defer func() { undoGlobalLogLevelChanges(t, originalLogLevel) diff --git a/internal/plog/plog.go b/internal/plog/plog.go index 060e70360..9b722fe52 100644 --- a/internal/plog/plog.go +++ b/internal/plog/plog.go @@ -1,4 +1,4 @@ -// Copyright 2020-2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package plog implements a thin layer over logr to help enforce pinniped's logging convention. @@ -190,7 +190,6 @@ func (p pLogger) withLogrMod(mod func(logr.Logger) logr.Logger) Logger { func (p pLogger) logr() logr.Logger { l := Logr() // grab the current global logger and its current config for _, mod := range p.mods { - mod := mod l = mod(l) // and then update it with all modifications } return l // this logger is guaranteed to have the latest config and all modifications diff --git a/internal/plog/plog_test.go b/internal/plog/plog_test.go index c116a939e..1359c23aa 100644 --- a/internal/plog/plog_test.go +++ b/internal/plog/plog_test.go @@ -357,7 +357,6 @@ func TestPlog(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/registry/clientsecretrequest/rest_test.go b/internal/registry/clientsecretrequest/rest_test.go index 0595de17c..4a1f7aab3 100644 --- a/internal/registry/clientsecretrequest/rest_test.go +++ b/internal/registry/clientsecretrequest/rest_test.go @@ -1557,8 +1557,6 @@ func TestCreate(t *testing.T) { }, } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { // t.Parallel() should not be used because we are mutating the global logger. var log bytes.Buffer diff --git a/internal/registry/whoamirequest/rest_test.go b/internal/registry/whoamirequest/rest_test.go index c840479cc..77f9a53ee 100644 --- a/internal/registry/whoamirequest/rest_test.go +++ b/internal/registry/whoamirequest/rest_test.go @@ -1,4 +1,4 @@ -// Copyright 2021-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package whoamirequest @@ -193,7 +193,6 @@ func TestCreate(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { r := &REST{} got, err := r.Create(tt.args.ctx, tt.args.obj, tt.args.createValidation, tt.args.options) diff --git a/internal/supervisor/scheme/scheme_test.go b/internal/supervisor/scheme/scheme_test.go index 8c0b0bde5..af2cebeb9 100644 --- a/internal/supervisor/scheme/scheme_test.go +++ b/internal/supervisor/scheme/scheme_test.go @@ -1,4 +1,4 @@ -// Copyright 2022 the Pinniped contributors. All Rights Reserved. +// Copyright 2022-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package scheme @@ -133,7 +133,6 @@ func TestNew(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { scheme, clientSecretGV := New(tt.apiGroupSuffix) require.Equal(t, tt.want, scheme.AllKnownTypes()) diff --git a/internal/tokenclient/tokenclient_test.go b/internal/tokenclient/tokenclient_test.go index 365d83bcb..426c0f29f 100644 --- a/internal/tokenclient/tokenclient_test.go +++ b/internal/tokenclient/tokenclient_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2023-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package tokenclient @@ -90,7 +90,6 @@ func TestNew(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -166,7 +165,6 @@ func TestFetchToken(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -323,7 +321,6 @@ func TestStart(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/internal/upstreamldap/upstreamldap_test.go b/internal/upstreamldap/upstreamldap_test.go index 8842292ff..c8308f96a 100644 --- a/internal/upstreamldap/upstreamldap_test.go +++ b/internal/upstreamldap/upstreamldap_test.go @@ -2172,7 +2172,6 @@ func TestUpstreamRefresh(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { ctrl := gomock.NewController(t) t.Cleanup(ctrl.Finish) diff --git a/internal/upstreamoidc/upstreamoidc_test.go b/internal/upstreamoidc/upstreamoidc_test.go index 1090d4b70..904bf6b21 100644 --- a/internal/upstreamoidc/upstreamoidc_test.go +++ b/internal/upstreamoidc/upstreamoidc_test.go @@ -22,6 +22,7 @@ import ( "go.uber.org/mock/gomock" "golang.org/x/oauth2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" "go.pinniped.dev/internal/federationdomain/dynamicupstreamprovider" "go.pinniped.dev/internal/federationdomain/upstreamprovider" @@ -241,7 +242,6 @@ func TestProviderConfig(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { tokenServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { require.Equal(t, http.MethodPost, r.Method) @@ -310,7 +310,7 @@ func TestProviderConfig(t *testing.T) { return } require.NoError(t, err) - require.Equal(t, &tt.wantToken, tok) + require.Equal(t, ptr.To(tt.wantToken), tok) require.Equal(t, tt.wantUserInfoCalled, p.Provider.(*mockProvider).called) }) } @@ -413,7 +413,6 @@ func TestProviderConfig(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { tokenServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { require.Equal(t, http.MethodPost, r.Method) @@ -649,7 +648,6 @@ func TestProviderConfig(t *testing.T) { }, } for _, tt := range tests { - tt := tt numRequests := 0 t.Run(tt.name, func(t *testing.T) { tokenServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -1086,7 +1084,6 @@ func TestProviderConfig(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { p := ProviderConfig{ Name: "test-name", @@ -1334,7 +1331,6 @@ func TestProviderConfig(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { tokenServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { require.Equal(t, http.MethodPost, r.Method) @@ -1404,7 +1400,7 @@ func TestProviderConfig(t *testing.T) { return } require.NoError(t, err) - require.Equal(t, &tt.wantToken, tok) + require.Equal(t, ptr.To(tt.wantToken), tok) require.Equal(t, tt.wantUserInfoCalled, p.Provider.(*mockProvider).called) }) } diff --git a/internal/valuelesscontext/valuelesscontext_test.go b/internal/valuelesscontext/valuelesscontext_test.go index ba593dfe1..4938a4f13 100644 --- a/internal/valuelesscontext/valuelesscontext_test.go +++ b/internal/valuelesscontext/valuelesscontext_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 the Pinniped contributors. All Rights Reserved. +// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package valuelesscontext @@ -208,7 +208,6 @@ func TestNew(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/pkg/conciergeclient/conciergeclient_test.go b/pkg/conciergeclient/conciergeclient_test.go index d44c9508e..edc1148c6 100644 --- a/pkg/conciergeclient/conciergeclient_test.go +++ b/pkg/conciergeclient/conciergeclient_test.go @@ -135,7 +135,6 @@ func TestNew(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() got, err := New(tt.opts...) diff --git a/pkg/oidcclient/filesession/cachefile_test.go b/pkg/oidcclient/filesession/cachefile_test.go index 413cd5f02..cf1cf7640 100644 --- a/pkg/oidcclient/filesession/cachefile_test.go +++ b/pkg/oidcclient/filesession/cachefile_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package filesession @@ -91,7 +91,6 @@ func TestReadSessionCache(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() got, err := readSessionCache(tt.path) diff --git a/pkg/oidcclient/filesession/filesession_test.go b/pkg/oidcclient/filesession/filesession_test.go index f2ff116c3..ec9e0dec9 100644 --- a/pkg/oidcclient/filesession/filesession_test.go +++ b/pkg/oidcclient/filesession/filesession_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package filesession @@ -218,7 +218,6 @@ func TestGetToken(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() tmp := t.TempDir() + "/sessions.yaml" @@ -476,7 +475,6 @@ func TestPutToken(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() tmp := t.TempDir() + "/sessiondir/sessions.yaml" diff --git a/pkg/oidcclient/login_test.go b/pkg/oidcclient/login_test.go index 949419e9e..7cfded622 100644 --- a/pkg/oidcclient/login_test.go +++ b/pkg/oidcclient/login_test.go @@ -2391,7 +2391,6 @@ func TestLogin(t *testing.T) { //nolint:gocyclo }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { testLogger := testlogger.NewLegacy(t) //nolint:staticcheck // old test with lots of log statements klog.SetLogger(testLogger.Logger) // this is unfortunately a global logger, so can't run these tests in parallel :( @@ -2603,7 +2602,6 @@ func TestHandlePasteCallback(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -2914,7 +2912,6 @@ func TestHandleAuthCodeCallback(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/test/integration/cli_test.go b/test/integration/cli_test.go index 0da362f66..f3cf3b80c 100644 --- a/test/integration/cli_test.go +++ b/test/integration/cli_test.go @@ -73,7 +73,6 @@ func TestCLIGetKubeconfigStaticToken_Parallel(t *testing.T) { testlib.AccessAsUserWithKubectlTest(stdout, env.TestUser.ExpectedUsername, env.ConciergeNamespace), ) for _, group := range env.TestUser.ExpectedGroups { - group := group t.Run( "access as group "+group+" with kubectl", testlib.AccessAsGroupWithKubectlTest(stdout, group, env.ConciergeNamespace), @@ -86,7 +85,6 @@ func TestCLIGetKubeconfigStaticToken_Parallel(t *testing.T) { // Validate that we can auth to the API via our user. t.Run("access as user with client-go", testlib.AccessAsUserTest(ctx, env.TestUser.ExpectedUsername, kubeClient)) for _, group := range env.TestUser.ExpectedGroups { - group := group t.Run("access as group "+group+" with client-go", testlib.AccessAsGroupTest(ctx, group, kubeClient)) } diff --git a/test/integration/concierge_api_serving_certs_test.go b/test/integration/concierge_api_serving_certs_test.go index d5350c056..8d08c6dc7 100644 --- a/test/integration/concierge_api_serving_certs_test.go +++ b/test/integration/concierge_api_serving_certs_test.go @@ -72,7 +72,6 @@ func TestAPIServingCertificateAutoCreationAndRotation_Disruptive(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { kubeClient := testlib.NewKubernetesClientset(t) aggregatedClient := testlib.NewAggregatedClientset(t) diff --git a/test/integration/concierge_credentialrequest_test.go b/test/integration/concierge_credentialrequest_test.go index cadf16de9..9292f487c 100644 --- a/test/integration/concierge_credentialrequest_test.go +++ b/test/integration/concierge_credentialrequest_test.go @@ -94,7 +94,6 @@ func TestSuccessfulCredentialRequest_Browser(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { authenticator := test.authenticator(ctx, t) token, username, groups := test.token(t) @@ -132,7 +131,6 @@ func TestSuccessfulCredentialRequest_Browser(t *testing.T) { testlib.AccessAsUserTest(ctx, username, clientWithCertFromCredentialRequest), ) for _, group := range groups { - group := group t.Run( "access as group "+group, testlib.AccessAsGroupTest(ctx, group, clientWithCertFromCredentialRequest), diff --git a/test/integration/concierge_impersonation_proxy_test.go b/test/integration/concierge_impersonation_proxy_test.go index 38ebb23ce..28ed71704 100644 --- a/test/integration/concierge_impersonation_proxy_test.go +++ b/test/integration/concierge_impersonation_proxy_test.go @@ -328,7 +328,6 @@ func TestImpersonationProxy(t *testing.T) { //nolint:gocyclo // yeah, it's compl testlib.AccessAsUserTest(ctx, env.TestUser.ExpectedUsername, impersonationProxyKubeClient(t)), ) for _, group := range env.TestUser.ExpectedGroups { - group := group t.Run( "access as group "+group, testlib.AccessAsGroupTest(ctx, group, impersonationProxyKubeClient(t)), @@ -2042,8 +2041,6 @@ func ensureDNSResolves(t *testing.T, urlString string) { defer cancel() for _, resolver := range []*net.Resolver{goResolver, notGoResolver} { - resolver := resolver - ips, ipErr := resolver.LookupIPAddr(ctx, host) requireEventually.NoError(ipErr) requireEventually.NotEmpty(ips) diff --git a/test/integration/kube_api_discovery_test.go b/test/integration/kube_api_discovery_test.go index dbf9e2155..5136f1aff 100644 --- a/test/integration/kube_api_discovery_test.go +++ b/test/integration/kube_api_discovery_test.go @@ -463,10 +463,9 @@ func TestGetAPIResourceList(t *testing.T) { //nolint:gocyclo // each t.Run is pr }) for _, tt := range tests { - tt := tt t.Run(tt.group.Name, func(t *testing.T) { t.Parallel() - require.Contains(t, groups, &tt.group) + require.Contains(t, groups, tt.group.DeepCopy()) for groupVersion, expectedResources := range tt.resourceByVersion { // Find the actual resource list and make a copy. diff --git a/test/integration/leaderelection_test.go b/test/integration/leaderelection_test.go index 58853382a..1d9c42d8a 100644 --- a/test/integration/leaderelection_test.go +++ b/test/integration/leaderelection_test.go @@ -182,7 +182,6 @@ func leaderElectionClients(t *testing.T, namespace *corev1.Namespace, leaseName func pickRandomLeaderElectionClient(clients map[string]*kubeclient.Client) *kubeclient.Client { for _, client := range clients { - client := client return client } panic("clients map was empty") @@ -223,8 +222,6 @@ func runWriteRequests(ctx context.Context, clients map[string]*kubeclient.Client out := make(map[string]error, len(clients)) for identity, client := range clients { - identity, client := identity, client - out[identity] = runWriteRequest(ctx, client) } @@ -246,8 +243,6 @@ func checkOnlyLeaderCanWrite(ctx context.Context, t *testing.T, namespace *corev testlib.RequireEventually(t, func(requireEventually *require.Assertions) { var leaders, nonLeaders int for identity, err := range runWriteRequests(ctx, clients) { - identity, err := identity, err - if identity == *lease.Spec.HolderIdentity { leaders++ requireEventually.NoError(err, "leader client %q should have no error", identity) diff --git a/test/integration/main_test.go b/test/integration/main_test.go index 5995ef0be..f3b5992aa 100644 --- a/test/integration/main_test.go +++ b/test/integration/main_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package integration @@ -39,8 +39,6 @@ func splitIntegrationTestsIntoBuckets(m *testing.M) { var serialTests, parallelTests, disruptiveTests, finalTests []testing.InternalTest for _, test := range tests { - test := test - // top level integration tests the end with the string _Parallel // are indicating that they are safe to run in parallel with // other serial tests (which Go does not let you easily express). @@ -69,7 +67,6 @@ func splitIntegrationTestsIntoBuckets(m *testing.M) { t.Parallel() // outer test always runs in parallel for this bucket for _, test := range serialTests { - test := test t.Run(test.Name, func(t *testing.T) { test.F(t) // inner serial tests do not run in parallel }) @@ -84,7 +81,6 @@ func splitIntegrationTestsIntoBuckets(m *testing.M) { t.Parallel() // outer test always runs in parallel for this bucket for _, test := range parallelTests { - test := test t.Run(test.Name, func(t *testing.T) { t.Parallel() // inner parallel tests do run in parallel @@ -101,7 +97,6 @@ func splitIntegrationTestsIntoBuckets(m *testing.M) { // outer test never runs in parallel for this bucket for _, test := range disruptiveTests { - test := test t.Run(test.Name, func(t *testing.T) { test.F(t) // inner disruptive tests do not run in parallel }) diff --git a/test/integration/securetls_test.go b/test/integration/securetls_test.go index 209e1dd89..ab48394a5 100644 --- a/test/integration/securetls_test.go +++ b/test/integration/securetls_test.go @@ -128,7 +128,6 @@ func TestSecureTLSSupervisor(t *testing.T) { defaultECDSAOnly := ptls.Default(nil) ciphers := make([]uint16, 0, len(defaultECDSAOnly.CipherSuites)/2) for _, id := range defaultECDSAOnly.CipherSuites { - id := id if !strings.Contains(tls.CipherSuiteName(id), "_ECDSA_") { continue } diff --git a/test/integration/supervisor_discovery_test.go b/test/integration/supervisor_discovery_test.go index 09f35bd6c..e1ea9dec4 100644 --- a/test/integration/supervisor_discovery_test.go +++ b/test/integration/supervisor_discovery_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package integration @@ -73,7 +73,6 @@ func TestSupervisorOIDCDiscovery_Disruptive(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.Name, func(t *testing.T) { scheme := test.Scheme addr := test.Address diff --git a/test/integration/supervisor_oidc_client_test.go b/test/integration/supervisor_oidc_client_test.go index 1658eceb7..5a11746cd 100644 --- a/test/integration/supervisor_oidc_client_test.go +++ b/test/integration/supervisor_oidc_client_test.go @@ -398,7 +398,6 @@ func TestOIDCClientStaticValidation_Parallel(t *testing.T) { require.Len(t, statusErr.ErrStatus.Details.Causes, 4) out := make([]string, 0, len(statusErr.ErrStatus.Details.Causes)) for _, cause := range statusErr.ErrStatus.Details.Causes { - cause := cause out = append(out, fmt.Sprintf("%s: %s", cause.Field, cause.Message)) } sort.Strings(out) @@ -486,7 +485,6 @@ func TestOIDCClientStaticValidation_Parallel(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { if tt.skip { t.Skip() @@ -688,7 +686,6 @@ func TestOIDCClientControllerValidations_Parallel(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/test/integration/supervisor_oidcclientsecret_test.go b/test/integration/supervisor_oidcclientsecret_test.go index 0c9aa4787..1eb38b77f 100644 --- a/test/integration/supervisor_oidcclientsecret_test.go +++ b/test/integration/supervisor_oidcclientsecret_test.go @@ -1,4 +1,4 @@ -// Copyright 2022-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2022-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package integration @@ -207,8 +207,6 @@ func TestKubectlOIDCClientSecretRequest_Parallel(t *testing.T) { }, } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { t.Parallel() ctx, cancel := context.WithTimeout(context.Background(), 13*time.Minute) @@ -873,8 +871,6 @@ func TestCreateOIDCClientSecretRequest_Parallel(t *testing.T) { }, } for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { t.Parallel() ctx, cancel := context.WithTimeout(context.Background(), 13*time.Minute) diff --git a/test/integration/supervisor_secrets_test.go b/test/integration/supervisor_secrets_test.go index 2ee1643c8..4c4d0376a 100644 --- a/test/integration/supervisor_secrets_test.go +++ b/test/integration/supervisor_secrets_test.go @@ -1,4 +1,4 @@ -// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved. +// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package integration @@ -78,7 +78,6 @@ func TestSupervisorSecrets_Parallel(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { // Ensure a secret is created with the FederationDomain's JWKS. var updatedFederationDomain *configv1alpha1.FederationDomain