Skip to content

Commit

Permalink
samples: vision: address flakes due to collisions. (#1458)
Browse files Browse the repository at this point in the history
* vision: address flakes due to collisions.

* beta: convert batch future to actually wait for output properly.

* explicit imports

* additional explicit import
  • Loading branch information
shollyman authored and chingor13 committed Aug 13, 2020
1 parent 16df5e8 commit 81da681
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.UUID;

import org.junit.After;
import org.junit.Before;
Expand All @@ -42,7 +43,7 @@ public class DetectIT {
private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
private static final String ASSET_BUCKET = "cloud-samples-data";
private static final String OUTPUT_BUCKET = PROJECT_ID;
private static final String OUTPUT_PREFIX = "OCR_PDF_TEST_OUTPUT";
private static final String OUTPUT_PREFIX = "OCR_PDF_TEST_OUTPUT_" + UUID.randomUUID().toString();

@Before
public void setUp() throws IOException {
Expand Down Expand Up @@ -363,13 +364,13 @@ public void testDetectDocumentsGcs() throws Exception {

// Assert
String got = bout.toString();

assertThat(got).contains("OIL, GAS AND MINERAL LEASE");

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();
}
Expand Down Expand Up @@ -397,4 +398,4 @@ public void testDetectLocalizedObjectsGcs() throws Exception {
String got = bout.toString().toLowerCase();
assertThat(got).contains("dog");
}
}
}

0 comments on commit 81da681

Please sign in to comment.