@@ -218,11 +218,12 @@ func (c *CouchbaseContainer) waitUntilNodeIsOnline(ctx context.Context) error {
218218 WithStatusCodeMatcher (func (status int ) bool {
219219 return status == http .StatusOK
220220 }).
221+ WithBasicAuth (c .config .username , c .config .password ).
221222 WaitUntilReady (ctx , c )
222223}
223224
224225func (c * CouchbaseContainer ) initializeIsEnterprise (ctx context.Context ) error {
225- response , err := c .doHTTPRequest (ctx , MGMT_PORT , "/pools" , http .MethodGet , nil , false )
226+ response , err := c .doHTTPRequest (ctx , MGMT_PORT , "/pools" , http .MethodGet , nil )
226227 if err != nil {
227228 return err
228229 }
@@ -251,7 +252,7 @@ func (c *CouchbaseContainer) renameNode(ctx context.Context) error {
251252 "hostname" : hostname ,
252253 }
253254
254- _ , err = c .doHTTPRequest (ctx , MGMT_PORT , "/node/controller/rename" , http .MethodPost , body , false )
255+ _ , err = c .doHTTPRequest (ctx , MGMT_PORT , "/node/controller/rename" , http .MethodPost , body )
255256
256257 return err
257258}
@@ -260,7 +261,7 @@ func (c *CouchbaseContainer) initializeServices(ctx context.Context) error {
260261 body := map [string ]string {
261262 "services" : c .getEnabledServices (),
262263 }
263- _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/node/controller/setupServices" , http .MethodPost , body , false )
264+ _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/node/controller/setupServices" , http .MethodPost , body )
264265
265266 return err
266267}
@@ -281,7 +282,7 @@ func (c *CouchbaseContainer) setMemoryQuotas(ctx context.Context) error {
281282 }
282283 }
283284
284- _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/pools/default" , http .MethodPost , body , false )
285+ _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/pools/default" , http .MethodPost , body )
285286
286287 return err
287288}
@@ -293,7 +294,7 @@ func (c *CouchbaseContainer) configureAdminUser(ctx context.Context) error {
293294 "port" : "SAME" ,
294295 }
295296
296- _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/settings/web" , http .MethodPost , body , false )
297+ _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/settings/web" , http .MethodPost , body )
297298
298299 return err
299300}
@@ -352,7 +353,7 @@ func (c *CouchbaseContainer) configureExternalPorts(ctx context.Context) error {
352353 body ["eventingSSL" ] = eventingSSL .Port ()
353354 }
354355
355- _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/node/controller/setupAlternateAddresses/external" , http .MethodPut , body , true )
356+ _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/node/controller/setupAlternateAddresses/external" , http .MethodPut , body )
356357
357358 return err
358359}
@@ -370,7 +371,7 @@ func (c *CouchbaseContainer) configureIndexer(ctx context.Context) error {
370371 "storageMode" : string (c .config .indexStorageMode ),
371372 }
372373
373- _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/settings/indexes" , http .MethodPost , body , true )
374+ _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/settings/indexes" , http .MethodPost , body )
374375
375376 return err
376377}
@@ -473,7 +474,7 @@ func (c *CouchbaseContainer) isPrimaryIndexOnline(ctx context.Context, bucket bu
473474 }
474475
475476 err := backoff .Retry (func () error {
476- response , err := c .doHTTPRequest (ctx , QUERY_PORT , "/query/service" , http .MethodPost , body , true )
477+ response , err := c .doHTTPRequest (ctx , QUERY_PORT , "/query/service" , http .MethodPost , body )
477478 if err != nil {
478479 return err
479480 }
@@ -494,7 +495,7 @@ func (c *CouchbaseContainer) createPrimaryIndex(ctx context.Context, bucket buck
494495 "statement" : "CREATE PRIMARY INDEX on `" + bucket .name + "`" ,
495496 }
496497 err := backoff .Retry (func () error {
497- response , err := c .doHTTPRequest (ctx , QUERY_PORT , "/query/service" , http .MethodPost , body , true )
498+ response , err := c .doHTTPRequest (ctx , QUERY_PORT , "/query/service" , http .MethodPost , body )
498499 firstError := gjson .Get (string (response ), "errors.0.code" ).Int ()
499500 if firstError != 0 {
500501 return errors .New ("index creation failed" )
@@ -510,7 +511,7 @@ func (c *CouchbaseContainer) isQueryKeyspacePresent(ctx context.Context, bucket
510511 }
511512
512513 err := backoff .Retry (func () error {
513- response , err := c .doHTTPRequest (ctx , QUERY_PORT , "/query/service" , http .MethodPost , body , true )
514+ response , err := c .doHTTPRequest (ctx , QUERY_PORT , "/query/service" , http .MethodPost , body )
514515 if err != nil {
515516 return err
516517 }
@@ -556,12 +557,12 @@ func (c *CouchbaseContainer) createBucket(ctx context.Context, bucket bucket) er
556557 "replicaNumber" : strconv .Itoa (bucket .numReplicas ),
557558 }
558559
559- _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/pools/default/buckets" , http .MethodPost , body , true )
560+ _ , err := c .doHTTPRequest (ctx , MGMT_PORT , "/pools/default/buckets" , http .MethodPost , body )
560561
561562 return err
562563}
563564
564- func (c * CouchbaseContainer ) doHTTPRequest (ctx context.Context , port , path , method string , body map [string ]string , auth bool ) ([]byte , error ) {
565+ func (c * CouchbaseContainer ) doHTTPRequest (ctx context.Context , port , path , method string , body map [string ]string ) ([]byte , error ) {
565566 form := url.Values {}
566567 for k , v := range body {
567568 form .Set (k , v )
@@ -581,10 +582,7 @@ func (c *CouchbaseContainer) doHTTPRequest(ctx context.Context, port, path, meth
581582 }
582583
583584 request .Header .Add ("Content-Type" , "application/x-www-form-urlencoded" )
584-
585- if auth {
586- request .SetBasicAuth (c .config .username , c .config .password )
587- }
585+ request .SetBasicAuth (c .config .username , c .config .password )
588586
589587 response , err := http .DefaultClient .Do (request )
590588 if err != nil {
0 commit comments