Skip to content

Commit ac6a398

Browse files
committed
pr comment
1 parent c6f38e3 commit ac6a398

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)