Skip to content

Commit b16f681

Browse files
authored
test(samples): prevent failure in nightly run by adding retry (#392)
Fixes #381 ☕️
1 parent 31dce1a commit b16f681

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

vision/snippets/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@
6363
<version>4.13.2</version>
6464
<scope>test</scope>
6565
</dependency>
66+
<dependency>
67+
<groupId>com.google.cloud</groupId>
68+
<artifactId>google-cloud-core</artifactId>
69+
<version>1.94.0</version>
70+
<scope>test</scope>
71+
<classifier>tests</classifier>
72+
</dependency>
6673
<dependency>
6774
<groupId>com.google.truth</groupId>
6875
<artifactId>truth</artifactId>

vision/snippets/src/test/java/com/example/vision/DetectIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
import com.google.cloud.storage.Storage;
2424
import com.google.cloud.storage.Storage.BlobListOption;
2525
import com.google.cloud.storage.StorageOptions;
26+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2627
import java.io.ByteArrayOutputStream;
2728
import java.io.PrintStream;
2829
import java.util.UUID;
2930
import org.junit.After;
3031
import org.junit.Before;
32+
import org.junit.Rule;
3133
import org.junit.Test;
3234
import org.junit.runner.RunWith;
3335
import org.junit.runners.JUnit4;
@@ -58,6 +60,9 @@ public void tearDown() {
5860
System.setOut(originalPrintStream);
5961
}
6062

63+
@Rule
64+
public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
65+
6166
@Test
6267
public void testDocumentText() throws Exception {
6368
// Act

0 commit comments

Comments
 (0)