@@ -188,15 +188,22 @@ func TestCommandConfigOauth_Authenticate(t *testing.T) {
188188 // end test case
189189
190190 // Begin test case
191- noParamsConfig = & auth_providers.CommandConfigOauth {}
192- httpsFailEnvExpected := []string {"tls: failed to verify certificate" }
193- authOauthTest (
194- t ,
195- fmt .Sprintf ("w/o env %s" , auth_providers .EnvKeyfactorCACert ),
196- true ,
197- noParamsConfig ,
198- httpsFailEnvExpected ... ,
199- )
191+
192+ if os .Getenv ("TEST_UNTRUSTED_CERT" ) == "1" || os .Getenv ("TEST_UNTRUSTED_CERT" ) == "true" {
193+ noParamsConfig = & auth_providers.CommandConfigOauth {}
194+ httpsFailEnvExpected := []string {"tls: failed to verify certificate" }
195+ t .Log ("Testing oAuth with https fail env" )
196+ t .Logf ("Setting environment variable %s" , auth_providers .EnvKeyfactorSkipVerify )
197+ os .Setenv (auth_providers .EnvKeyfactorSkipVerify , "false" )
198+ authOauthTest (
199+ t ,
200+ fmt .Sprintf ("w/o env %s" , auth_providers .EnvKeyfactorCACert ),
201+ true ,
202+ noParamsConfig ,
203+ httpsFailEnvExpected ... ,
204+ )
205+ }
206+
200207 // end test case
201208
202209 t .Log ("Testing oAuth with invalid config file path" )
@@ -314,15 +321,17 @@ func TestCommandConfigOauth_Authenticate(t *testing.T) {
314321 t .Logf ("Unsetting environment variable %s" , auth_providers .EnvKeyfactorSkipVerify )
315322 os .Unsetenv (auth_providers .EnvKeyfactorSkipVerify )
316323
317- t .Log ("Testing oAuth with valid implicit config file https fail" )
318- httpsFailConfigFile := & auth_providers.CommandConfigOauth {}
319- httpsFailConfigFile .
320- WithConfigProfile ("oauth" )
321- httpsFailConfigFileExpected := []string {"tls: failed to verify certificate" }
322- authOauthTest (
323- t , "oAuth with valid implicit config file https fail" , true , httpsFailConfigFile ,
324- httpsFailConfigFileExpected ... ,
325- )
324+ if os .Getenv ("TEST_UNTRUSTED_CERT" ) == "1" || os .Getenv ("TEST_UNTRUSTED_CERT" ) == "true" {
325+ t .Log ("Testing oAuth with valid implicit config file https fail" )
326+ httpsFailConfigFile := & auth_providers.CommandConfigOauth {}
327+ httpsFailConfigFile .
328+ WithConfigProfile ("oauth" )
329+ httpsFailConfigFileExpected := []string {"tls: failed to verify certificate" }
330+ authOauthTest (
331+ t , "oAuth with valid implicit config file https fail" , true , httpsFailConfigFile ,
332+ httpsFailConfigFileExpected ... ,
333+ )
334+ }
326335
327336 t .Log ("Testing oAuth with invalid profile implicit config file" )
328337 invProfile := & auth_providers.CommandConfigOauth {}
0 commit comments