Skip to content

Commit 644e86d

Browse files
jean-philippe-martinchingor13
authored andcommitted
Storage NIO: Stop leaving leftover buckets in IT (#3898)
* Stop leaving leftover buckets in ITGcsNIO This integration test now deletes all the buckets it creates. The issue was that requester-pays buckets couldn't be deleted by the existing code. This PR updates RemoteStorageHelper so it can be given a userProject for requester-pays buckets. * Don't set userProject if empty, add test RemoteStorageHelper now doesn't set the userProject option if it's empty. Also, added testForceDeleteRetriesWithUserProject unit test.
1 parent f030701 commit 644e86d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • java-storage-nio/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/it

java-storage-nio/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/it/ITGcsNio.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,13 @@ public static void beforeClass() throws IOException {
127127

128128
@AfterClass
129129
public static void afterClass() throws ExecutionException, InterruptedException {
130-
if (storage != null && !RemoteStorageHelper.forceDelete(storage, BUCKET, 5, TimeUnit.SECONDS) &&
131-
log.isLoggable(Level.WARNING)) {
132-
log.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
130+
if (storage != null) {
131+
for (String bucket : new String[]{BUCKET, REQUESTER_PAYS_BUCKET}) {
132+
if (!RemoteStorageHelper.forceDelete(storage, bucket, 5, TimeUnit.SECONDS, project) &&
133+
log.isLoggable(Level.WARNING)) {
134+
log.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", bucket);
135+
}
136+
}
133137
}
134138
}
135139

0 commit comments

Comments
 (0)