Improve unit tests in tokenclient_test.go

Also fix a linter error and rename some new files.
This commit is contained in:
Ryan Richard
2023-11-30 13:29:52 -08:00
parent c439cc03a2
commit 5f4645d505
5 changed files with 217 additions and 82 deletions
@@ -274,7 +274,7 @@ func TestImpersonatorConfigControllerSync(t *testing.T) {
const httpsPort = ":443"
const fakeServerResponseBody = "hello, world!"
const externallyProvidedTLSSecretName = "external-tls-secret" //nolint:gosec // this is not a credential
fakeExpiringSingletonTokenCacheGet := *new(tokenclient.ExpiringSingletonTokenCacheGet)
var fakeExpiringSingletonTokenCacheGet = tokenclient.NewExpiringSingletonTokenCache()
var labels = map[string]string{"app": "app-name", "other-key": "other-value"}
var r *require.Assertions
@@ -132,6 +132,8 @@ func TestSync(t *testing.T) {
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
kubeAPIClient, kubeInformers := setupKubernetes(t, tt.namespace)
if tt.addReactors != nil {
tt.addReactors(kubeAPIClient)