Skip to content

Commit adc14b9

Browse files
authored
chore: Fix broken sample tests (#2578)
* chore: Fix broken sample tests
1 parent 3030081 commit adc14b9

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

google-cloud-storage/src/main/java/com/google/cloud/storage/testing/RemoteStorageHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void run() {
9999
}
100100
forceDelete(storage, bucket.getName());
101101
} catch (Exception e) {
102-
// Ignore the exception, maybe the bucket is being deleted by someone else.
102+
log.info("Failed to clean buckets " + e.getMessage());
103103
}
104104
}
105105
}
@@ -298,6 +298,7 @@ public Boolean call() {
298298
}
299299
return true;
300300
} catch (StorageException e) {
301+
log.warning("Caught exception in Delete Bucket Task" + e.getMessage());
301302
if (e.getCode() == 409) {
302303
try {
303304
Thread.sleep(500);

samples/snippets/src/test/java/com/example/storage/ITStorageSnippets.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ public static void beforeClass() {
6767
@AfterClass
6868
public static void afterClass() throws ExecutionException, InterruptedException {
6969
if (storage != null) {
70-
// In beforeClass, we make buckets auto-delete blobs older than a day old.
71-
// Here, delete all buckets older than 2 days. They should already be empty and easy.
72-
long cleanTime = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(2);
73-
long cleanTimeout = System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(1);
74-
RemoteStorageHelper.cleanBuckets(storage, cleanTime, cleanTimeout);
75-
7670
boolean wasDeleted = RemoteStorageHelper.forceDelete(storage, BUCKET, 1, TimeUnit.MINUTES);
7771
if (!wasDeleted && log.isLoggable(Level.WARNING)) {
7872
log.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);

0 commit comments

Comments
 (0)