File tree Expand file tree Collapse file tree
google-cloud-storage/src/test/java/com/google/cloud/storage/it Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -408,7 +408,7 @@ public void testListBlobsEmptySelectedFields() throws InterruptedException {
408408 }
409409 }
410410
411- @ Test (timeout = 5000 )
411+ @ Test (timeout = 7500 )
412412 public void testListBlobRequesterPays () throws InterruptedException {
413413 BlobInfo blob1 =
414414 BlobInfo .newBuilder (BUCKET , "test-list-blobs-empty-selected-fields-blob1" )
@@ -434,16 +434,19 @@ public void testListBlobRequesterPays() throws InterruptedException {
434434 }
435435
436436 String projectId = remoteStorageHelper .getOptions ().getProjectId ();
437- for (; ; ) {
437+ while ( true ) {
438438 Page <Blob > page =
439439 storage .list (
440440 BUCKET ,
441441 Storage .BlobListOption .prefix ("test-list-blobs-empty-selected-fields-blob" ),
442442 Storage .BlobListOption .fields (),
443443 Storage .BlobListOption .userProject (projectId ));
444- int size = Iterators .size (page .iterateAll ().iterator ());
445- if (size == 1 ) {
446- break ;
444+ List <Blob > blobs = Lists .newArrayList (page .iterateAll ());
445+ // If the list is empty, maybe the blob isn't visible yet; wait and try again.
446+ // Otherwise, expect one blob, since we only put in one above.
447+ if (!blobs .isEmpty ()) {
448+ assertThat (blobs ).hasSize (1 );
449+ return ;
447450 }
448451 Thread .sleep (500 );
449452 }
You can’t perform that action at this time.
0 commit comments