Renamed Login method specific to tests, to make things more explicit

This commit is contained in:
Guillaume Tardif 2020-06-30 10:11:06 +02:00
parent 82ff8dcd7d
commit 2268f0c598
2 changed files with 4 additions and 4 deletions

View File

@ -94,8 +94,9 @@ func newAzureLoginServiceFromPath(tokenStorePath string, helper apiHelper) (Azur
}, nil
}
// LoginFromServicePrincipal login with clientId / clientSecret from a previously created service principal
func (login AzureLoginService) LoginFromServicePrincipal(clientID string, clientSecret string, tenantID string) error {
// TestLoginFromServicePrincipal login with clientId / clientSecret from a previously created service principal.
// The resulting token does not include a refresh token, used for tests only
func (login AzureLoginService) TestLoginFromServicePrincipal(clientID string, clientSecret string, tenantID string) error {
// Tried with auth2.NewUsernamePasswordConfig() but could not make this work with username / password, setting this for CI with clientID / clientSecret
creds := auth2.NewClientCredentialsConfig(clientID, clientSecret, tenantID)

View File

@ -71,7 +71,6 @@ func (s *E2eACISuite) TestContextDefault() {
}
func (s *E2eACISuite) TestACIBackend() {
It("Logs in azure using service principal credentials", func() {
login, err := login.NewAzureLoginService()
Expect(err).To(BeNil())
@ -79,7 +78,7 @@ func (s *E2eACISuite) TestACIBackend() {
clientID := os.Getenv("AZURE_CLIENT_ID")
clientSecret := os.Getenv("AZURE_CLIENT_SECRET")
tenantID := os.Getenv("AZURE_TENANT_ID")
err = login.LoginFromServicePrincipal(clientID, clientSecret, tenantID)
err = login.TestLoginFromServicePrincipal(clientID, clientSecret, tenantID)
Expect(err).To(BeNil())
})