@@ -19,19 +19,13 @@ package e2e
1919import (
2020 "bytes"
2121 "context"
22- "crypto/tls"
2322 "fmt"
24- "io"
25- "net/http"
26- "net/url"
2723 "os/exec"
2824 "path/filepath"
2925 "reflect"
3026 "strings"
3127 "time"
3228
33- "encoding/json"
34-
3529 argoapp "github.com/argoproj-labs/argocd-operator/api/v1beta1"
3630 "github.com/argoproj-labs/argocd-operator/common"
3731 "github.com/argoproj-labs/argocd-operator/controllers/argoutil"
@@ -706,61 +700,6 @@ var _ = Describe("GitOpsServiceController", func() {
706700
707701})
708702
709- type tokenResponse struct {
710- AccessToken string `json:"access_token"`
711- ExpiresIn int `json:"expires_in"`
712- RefreshExpiresIn int `json:"refresh_expires_in"`
713- RefreshToken string `json:"refresh_token"`
714- TokenType string `json:"token_type"`
715- NotBeforePolicy int `json:"not-before-policy"`
716- SessionState string `json:"session_state"`
717- Error string `json:"error"`
718- ErrorDescription string `json:"error_description"`
719- }
720-
721- func getAccessToken (user , pass , accessURL string ) (string , error ) {
722- form := url.Values {}
723- form .Add ("username" , user )
724- form .Add ("password" , pass )
725- form .Add ("client_id" , "admin-cli" )
726- form .Add ("grant_type" , "password" )
727-
728- client := http.Client {}
729- http .DefaultTransport .(* http.Transport ).TLSClientConfig = & tls.Config {InsecureSkipVerify : true }
730- req , err := http .NewRequest (
731- "POST" ,
732- accessURL ,
733- strings .NewReader (form .Encode ()),
734- )
735- if err != nil {
736- return "" , err
737- }
738-
739- req .Header .Add ("Content-Type" , "application/x-www-form-urlencoded" )
740- res , err := client .Do (req )
741- if err != nil {
742- return "" , err
743- }
744-
745- defer res .Body .Close ()
746- body , err := io .ReadAll (res .Body )
747- if err != nil {
748- return "" , err
749- }
750-
751- tokenRes := & tokenResponse {}
752- err = json .Unmarshal (body , tokenRes )
753- if err != nil {
754- return "" , err
755- }
756-
757- if tokenRes .Error != "" {
758- return "" , err
759- }
760-
761- return tokenRes .AccessToken , nil
762- }
763-
764703func runCommandWithOutput (cmdList ... string ) (string , string , error ) {
765704
766705 // Output the commands to be run, so that if the test fails we can determine why
0 commit comments