File tree Expand file tree Collapse file tree 1 file changed +32
-20
lines changed
modules/couchbase/src/main/java/org/testcontainers/couchbase Expand file tree Collapse file tree 1 file changed +32
-20
lines changed Original file line number Diff line number Diff line change @@ -685,28 +685,40 @@ private void createBuckets() {
685685
686686 if (bucket .hasPrimaryIndex ()) {
687687 if (enabledServices .contains (CouchbaseService .QUERY )) {
688- @ Cleanup
689- Response queryResponse = doHttpRequest (
690- QUERY_PORT ,
691- "/query/service" ,
692- "POST" ,
693- new FormBody .Builder ()
694- .add ("statement" , "CREATE PRIMARY INDEX on `" + bucket .getName () + "`" )
695- .build (),
696- true
697- );
688+ timePhase (
689+ "createBucket:" + bucket .getName () + ":createPrimaryIndex" ,
690+ () -> {
691+ Unreliables .retryUntilSuccess (
692+ 1 ,
693+ TimeUnit .MINUTES ,
694+ () -> {
695+ @ Cleanup
696+ Response queryResponse = doHttpRequest (
697+ QUERY_PORT ,
698+ "/query/service" ,
699+ "POST" ,
700+ new FormBody .Builder ()
701+ .add ("statement" , "CREATE PRIMARY INDEX on `" + bucket .getName () + "`" )
702+ .build (),
703+ true
704+ );
698705
699- try {
700- checkSuccessfulResponse (
701- queryResponse ,
702- "Could not create primary index for bucket " + bucket .getName ()
703- );
704- } catch (IllegalStateException ex ) {
705- // potentially ignore the error, the index will be eventually built.
706- if (!ex .getMessage ().contains ("Index creation will be retried in background" )) {
707- throw ex ;
706+ try {
707+ checkSuccessfulResponse (
708+ queryResponse ,
709+ "Could not create primary index for bucket " + bucket .getName ()
710+ );
711+ } catch (IllegalStateException ex ) {
712+ // potentially ignore the error, the index will be eventually built.
713+ if (!ex .getMessage ().contains ("Index creation will be retried in background" )) {
714+ throw ex ;
715+ }
716+ }
717+ return null ;
718+ }
719+ );
708720 }
709- }
721+ );
710722
711723 timePhase (
712724 "createBucket:" + bucket .getName () + ":primaryIndexOnline" ,
You can’t perform that action at this time.
0 commit comments