From c6ad8cb2fe131bc9af02fb3c9976d7d281963d32 Mon Sep 17 00:00:00 2001 From: notfromstatefarm <86763948+notfromstatefarm@users.noreply.github.com> Date: Tue, 12 Jul 2022 15:07:45 -0400 Subject: [PATCH] fix tests Signed-off-by: notfromstatefarm <86763948+notfromstatefarm@users.noreply.github.com> --- util/dex/dex.go | 2 +- util/oidc/oidc_test.go | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/util/dex/dex.go b/util/dex/dex.go index 343573212426e..b3840a78eef7c 100644 --- a/util/dex/dex.go +++ b/util/dex/dex.go @@ -33,7 +33,7 @@ type DexTLSConfig struct { } func TLSConfig(tlsConfig *DexTLSConfig) *tls.Config { - if tlsConfig == nil { + if tlsConfig == nil || tlsConfig.DisableTLS { return nil } if !tlsConfig.StrictValidation { diff --git a/util/oidc/oidc_test.go b/util/oidc/oidc_test.go index 3aa8b3709f66d..eec2941384e4b 100644 --- a/util/oidc/oidc_test.go +++ b/util/oidc/oidc_test.go @@ -21,6 +21,7 @@ import ( "github.com/argoproj/argo-cd/v2/server/settings/oidc" "github.com/argoproj/argo-cd/v2/util" "github.com/argoproj/argo-cd/v2/util/crypto" + "github.com/argoproj/argo-cd/v2/util/dex" "github.com/argoproj/argo-cd/v2/util/settings" "github.com/argoproj/argo-cd/v2/util/test" ) @@ -178,9 +179,7 @@ requestedScopes: ["oidc"]`, oidcTestServer.URL), t.Fatal("did not receive expected certificate verification failure error") } - cdSettings.OIDCTLSInsecureSkipVerify = true - - app, err = NewClientApp(cdSettings, dexTestServer.URL, nil, "https://argocd.example.com") + app, err = NewClientApp(cdSettings, dexTestServer.URL, &dex.DexTLSConfig{StrictValidation: false}, "https://argocd.example.com") require.NoError(t, err) w = httptest.NewRecorder() @@ -262,9 +261,7 @@ requestedScopes: ["oidc"]`, oidcTestServer.URL), t.Fatal("did not receive expected certificate verification failure error") } - cdSettings.OIDCTLSInsecureSkipVerify = true - - app, err = NewClientApp(cdSettings, dexTestServer.URL, nil, "https://argocd.example.com") + app, err = NewClientApp(cdSettings, dexTestServer.URL, &dex.DexTLSConfig{StrictValidation: false}, "https://argocd.example.com") require.NoError(t, err) w = httptest.NewRecorder()