diff --git a/.kokoro/build.sh b/.kokoro/build.sh
index 49069482ff..a4856b2c77 100755
--- a/.kokoro/build.sh
+++ b/.kokoro/build.sh
@@ -28,14 +28,14 @@ mvn -version
echo ${JOB_TYPE}
# attempt to install 3 times with exponential backoff (starting with 10 seconds)
-retry_with_backoff 3 10 \
- mvn install -B -V -ntp \
- -DskipTests=true \
- -Dclirr.skip=true \
- -Denforcer.skip=true \
- -Dmaven.javadoc.skip=true \
- -Dgcloud.download.skip=true \
- -T 1C
+#retry_with_backoff 3 10 \
+# mvn install -B -V -ntp \
+# -DskipTests=true \
+# -Dclirr.skip=true \
+# -Denforcer.skip=true \
+# -Dmaven.javadoc.skip=true \
+# -Dgcloud.download.skip=true \
+# -T 1C
# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it
if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then
diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml
index 11b848198e..4a0b980b36 100644
--- a/samples/install-without-bom/pom.xml
+++ b/samples/install-without-bom/pom.xml
@@ -22,6 +22,7 @@
1.8
1.8
UTF-8
+ com.example.storage.ITVerboseBucketCleanupTest
@@ -32,6 +33,13 @@
google-cloud-storage
2.42.0
+
+ com.google.cloud
+ google-cloud-storage
+ 2.42.0
+ tests
+ test
+
com.google.cloud
google-cloud-storage-control
diff --git a/samples/pom.xml b/samples/pom.xml
index 9f17328f88..c6ded0963b 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -30,8 +30,8 @@
install-without-bom
- snapshot
- snippets
+
+
diff --git a/samples/snippets/src/test/java/com/example/storage/ITVerboseBucketCleanupTest.java b/samples/snippets/src/test/java/com/example/storage/ITVerboseBucketCleanupTest.java
new file mode 100644
index 0000000000..2c47d33dce
--- /dev/null
+++ b/samples/snippets/src/test/java/com/example/storage/ITVerboseBucketCleanupTest.java
@@ -0,0 +1,67 @@
+package com.example.storage;
+
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.Storage.BucketField;
+import com.google.cloud.storage.Storage.BucketListOption;
+import com.google.cloud.storage.StorageOptions;
+import com.google.cloud.storage.it.BucketCleaner;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import java.time.Instant;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
+import java.util.stream.Collectors;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.junit.Test;
+
+public final class ITVerboseBucketCleanupTest {
+ private static final Logger LOGGER = Logger.getLogger(ITVerboseBucketCleanupTest.class.getName());
+
+ @Test
+ public void verboseBucketCleanup() throws Exception {
+ ThreadFactory threadFactory = new ThreadFactoryBuilder()
+ .setDaemon(true)
+ .setNameFormat("cp-pool-%03d")
+ .build();
+
+ ListeningExecutorService exec = MoreExecutors.listeningDecorator(
+ Executors.newFixedThreadPool(4 * Runtime.getRuntime().availableProcessors(), threadFactory)
+ );
+
+ OffsetDateTime now = Instant.now().atOffset(ZoneOffset.UTC);
+ OffsetDateTime _7DaysAgo = now.minusDays(7);
+
+ try (Storage s = StorageOptions.http().build().getService()) {
+ List> deleteFutures = s.list(
+ BucketListOption.fields(BucketField.NAME, BucketField.TIME_CREATED))
+ .streamAll()
+ .map(bucket -> {
+ String name = bucket.getName();
+ OffsetDateTime ctime = bucket.getCreateTimeOffsetDateTime();
+ LOGGER.warning(String.format("bucket = {name: '%s', ctime: '%s'}%n", name, ctime));
+ if (ctime.isBefore(_7DaysAgo)) {
+ return exec.submit(() -> {
+ BucketCleaner.doCleanup(name, s);
+ return null;
+ });
+ } else {
+ return Futures.immediateVoidFuture();
+ }
+ })
+ .collect(Collectors.toList());
+
+ ListenableFuture> allFuture = Futures.allAsList(deleteFutures);
+
+ allFuture.get(15, TimeUnit.MINUTES);
+ }
+
+ }
+}