@@ -3,8 +3,7 @@ package e2e
33import (
44 "crypto/tls"
55 "fmt"
6- "io/ioutil"
7- "net/http"
6+ "io"
87 "os"
98 "path/filepath"
109 "strconv"
@@ -15,14 +14,13 @@ import (
1514 "github.com/gruntwork-io/terratest/modules/helm"
1615 "github.com/gruntwork-io/terratest/modules/k8s"
1716 "github.com/gruntwork-io/terratest/modules/random"
17+ "github.com/imroc/req/v3"
1818 "github.com/marklogic/marklogic-kubernetes/test/testUtil"
1919 "github.com/stretchr/testify/assert"
2020 "github.com/tidwall/gjson"
21- digestAuth "github.com/xinsnake/go-http-digest-auth-client"
2221)
2322
2423func TestHelmInstall (t * testing.T ) {
25- var resp * http.Response
2624 var body []byte
2725 var err error
2826 var podZeroName string
@@ -136,26 +134,31 @@ func TestHelmInstall(t *testing.T) {
136134 tunnel8002 .ForwardPort (t )
137135 endpointManage := fmt .Sprintf ("http://%s/manage/v2" , tunnel8002 .Endpoint ())
138136
139- request := digestAuth .NewRequest (username , password , "GET" , endpointManage , "" )
140- response , err := request .Execute ()
137+ client := req .C ().
138+ SetCommonDigestAuth (username , password ).
139+ SetCommonRetryCount (10 ).
140+ SetCommonRetryFixedInterval (10 * time .Second )
141+
142+ resp , err := client .R ().
143+ Get (endpointManage )
141144 if err != nil {
142145 t .Fatalf (err .Error ())
143146 }
144- defer response .Body .Close ()
147+ defer resp .Body .Close ()
145148 // the generated password should be able to access the manage endpoint
146- assert .Equal (t , 200 , response .StatusCode )
149+ assert .Equal (t , 200 , resp .StatusCode )
147150
148151 t .Log ("====Verify xdqp-ssl-enabled is set to true by default" )
149152 endpoint := fmt .Sprintf ("http://%s/manage/v2/groups/Default/properties?format=json" , tunnel8002 .Endpoint ())
150153 t .Logf (`Endpoint for group properties: %s` , endpoint )
151154
152- request = digestAuth . NewRequest ( username , password , "GET" , endpoint , "" )
153- resp , err = request . Execute ( )
155+ resp , err = client . R ().
156+ Get ( endpoint )
154157 if err != nil {
155158 t .Fatalf (err .Error ())
156159 }
157160 defer resp .Body .Close ()
158- body , err = ioutil .ReadAll (resp .Body )
161+ body , err = io .ReadAll (resp .Body )
159162 if err != nil {
160163 t .Fatalf (err .Error ())
161164 }
@@ -166,12 +169,16 @@ func TestHelmInstall(t *testing.T) {
166169
167170 t .Log ("====Verify no groups beyond default were created/modified====" )
168171 groupStatusEndpoint := fmt .Sprintf ("http://%s/manage/v2/groups?format=json" , tunnel8002 .Endpoint ())
169- groupStatus := digestAuth .NewRequest (username , password , "GET" , groupStatusEndpoint , "" )
170172 t .Logf (`groupStatusEndpoint: %s` , groupStatusEndpoint )
171- if resp , err = groupStatus .Execute (); err != nil {
173+ resp , err = client .R ().
174+ Get (groupStatusEndpoint )
175+
176+ if err != nil {
172177 t .Fatalf (err .Error ())
173178 }
174- if body , err = ioutil .ReadAll (resp .Body ); err != nil {
179+ defer resp .Body .Close ()
180+
181+ if body , err = io .ReadAll (resp .Body ); err != nil {
175182 t .Fatalf (err .Error ())
176183 }
177184 groupQuantityJSON := gjson .Get (string (body ), "group-default-list.list-items.list-count.value" )
0 commit comments