From f48a4e445e8c5b31a3925cdc2e77c51ee10cc533 Mon Sep 17 00:00:00 2001 From: Andrew Keesler Date: Wed, 7 Oct 2020 11:48:21 -0400 Subject: [PATCH] Fix linting and unit tests Signed-off-by: Andrew Keesler --- .../supervisorconfig/dynamic_config_watcher.go | 12 +++++++----- internal/oidc/discovery/discovery_test.go | 3 ++- internal/oidc/issuerprovider/issuerprovider_test.go | 4 ++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/internal/controller/supervisorconfig/dynamic_config_watcher.go b/internal/controller/supervisorconfig/dynamic_config_watcher.go index a060e4e99..085475b14 100644 --- a/internal/controller/supervisorconfig/dynamic_config_watcher.go +++ b/internal/controller/supervisorconfig/dynamic_config_watcher.go @@ -15,10 +15,6 @@ import ( "go.pinniped.dev/internal/controllerlib" ) -const ( - issuerConfigMapKey = "issuer" -) - // IssuerSetter can be notified of a valid issuer with its SetIssuer function. If there is no // longer any valid issuer, then nil can be passed to this interface. // @@ -79,7 +75,13 @@ func (c *dynamicConfigWatcherController) Sync(ctx controllerlib.Context) error { "oidcproviderconfig", klog.KRef(ctx.Key.Namespace, ctx.Key.Name), ) - c.issuerSetter.SetIssuer(nil) + if err := c.issuerSetter.SetIssuer(nil); err != nil { + klog.InfoS( + "dynamicConfigWatcherController Sync failed to set issuer", + "err", + err, + ) + } return nil } diff --git a/internal/oidc/discovery/discovery_test.go b/internal/oidc/discovery/discovery_test.go index 7d1c481d2..49f46bebc 100644 --- a/internal/oidc/discovery/discovery_test.go +++ b/internal/oidc/discovery/discovery_test.go @@ -93,7 +93,8 @@ func TestDiscovery(t *testing.T) { test := test t.Run(test.name, func(t *testing.T) { p := issuerprovider.New() - p.SetIssuer(test.issuer) + err := p.SetIssuer(test.issuer) + require.NoError(t, err) handler := New(p) req := httptest.NewRequest(test.method, test.path, nil) diff --git a/internal/oidc/issuerprovider/issuerprovider_test.go b/internal/oidc/issuerprovider/issuerprovider_test.go index 356b338b5..128502f43 100644 --- a/internal/oidc/issuerprovider/issuerprovider_test.go +++ b/internal/oidc/issuerprovider/issuerprovider_test.go @@ -1,3 +1,6 @@ +// Copyright 2020 the Pinniped contributors. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + package issuerprovider import ( @@ -62,6 +65,7 @@ func TestProvider(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { p := New() err := p.SetIssuer(tt.issuer)