diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/BucketCleaner.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/BucketCleaner.java index 83b40f8f63..765b209cdb 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/BucketCleaner.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/BucketCleaner.java @@ -101,7 +101,8 @@ public static void doCleanup(String bucketName, Storage s, StorageControlClient StorageLayout storageLayout = ctrl.getStorageLayout(StorageLayoutName.of(parent.getProject(), parent.getBucket())); List folderDeletes; - if (storageLayout.hasHierarchicalNamespace()) { + if (storageLayout.hasHierarchicalNamespace() + && storageLayout.getHierarchicalNamespace().getEnabled()) { folderDeletes = StreamSupport.stream(ctrl.listFolders(parent).iterateAll().spliterator(), false) .collect(Collectors.toList())