Skip to content

Commit

Permalink
samples: docs: update tests that are failing or not cleaning up resou…
Browse files Browse the repository at this point in the history
…rces
  • Loading branch information
nnegrey authored and lesv committed Mar 26, 2020
1 parent d1dd367 commit f9e9370
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions vision/snippets/src/test/java/com/example/vision/DetectIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

import static com.google.common.truth.Truth.assertThat;

import com.google.api.gax.paging.Page;
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.Storage.BlobListOption;
import com.google.cloud.storage.StorageOptions;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
Expand Down Expand Up @@ -135,5 +140,13 @@ public void testAsyncBatchAnnotateImagesGcs() throws Exception {
// Assert
String got = bout.toString();
assertThat(got).contains("red:");

Storage storage = StorageOptions.getDefaultInstance().getService();

Page<Blob> blobs = storage.list(OUTPUT_BUCKET, BlobListOption.currentDirectory(),
BlobListOption.prefix(OUTPUT_PREFIX + "/"));
for (Blob blob : blobs.iterateAll()) {
blob.delete();
}
}
}

0 comments on commit f9e9370

Please sign in to comment.