Skip to content

Commit 693368c

Browse files
authored
Flaky test fix (#1490)
* Rework the tests to remove flakiness (hopefully) * Update IDs since old test deleted my knowledge base * Update GCS links to fix permission denied errors * Use declared var
1 parent 1145729 commit 693368c

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

video/beta/src/test/java/com/example/video/DetectIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public void testTrackObjects() throws Exception {
8484

8585
@Test
8686
public void testTrackObjectsGcs() throws Exception {
87-
VideoAnnotationResults result = TrackObjects.trackObjectsGcs("gs://demomaker/cat.mp4");
87+
VideoAnnotationResults result = TrackObjects.trackObjectsGcs(
88+
"gs://cloud-samples-data/video/cat.mp4");
8889

8990
boolean textExists = false;
9091
for (ObjectTrackingAnnotation objectTrackingAnnotation : result.getObjectAnnotationsList()) {

video/cloud-client/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ After you have authorized, you can analyze videos.
3838

3939
Detect Labels
4040
```
41-
mvn exec:java -DDetect -Dexec.args="labels gs://demomaker/cat.mp4"
41+
mvn exec:java -DDetect -Dexec.args="labels gs://cloud-samples-data/video/cat.mp4"
4242
4343
mvn exec:java -DDetect -Dexec.args="labels-file ./resources/cat.mp4"
4444
```
4545

4646
Detect Explicit content annotations
4747
```
48-
mvn exec:java -DDetect -Dexec.args="explicit-content gs://demomaker/gbikes_dinosaur.mp4"
48+
mvn exec:java -DDetect -Dexec.args="explicit-content gs://cloud-samples-data/video/gbikes_dinosaur.mp4"
4949
```
5050

5151
Detect Shots
5252
```
53-
mvn exec:java -DDetect -Dexec.args="shots gs://demomaker/gbikes_dinosaur.mp4"
53+
mvn exec:java -DDetect -Dexec.args="shots gs://cloud-samples-data/video/gbikes_dinosaur.mp4"
5454
```
5555

5656
Transcribe Speech
@@ -60,7 +60,7 @@ mvn exec:java -DDetect -Dexec.args="speech-transcription gs://python-docs-sample
6060

6161
From Windows, you may need to supply your classpath differently, for example:
6262
```
63-
mvn exec:java -DDetect -Dexec.args="labels gs://demomaker/cat.mp4"
63+
mvn exec:java -DDetect -Dexec.args="labels gs://cloud-samples-data/video/cat.mp4"
6464
```
6565
or
6666
```

video/cloud-client/src/main/java/com/example/video/QuickstartSample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static void main(String[] args) throws Exception {
3939
// Instantiate a video intelligence client
4040
try (VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create()) {
4141
// The Google Cloud Storage path to the video to annotate.
42-
String gcsUri = "gs://demomaker/cat.mp4";
42+
String gcsUri = "gs://cloud-samples-data/video/cat.mp4";
4343

4444
// Create an operation that will contain the response when the operation completes.
4545
AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder()

video/cloud-client/src/test/java/com/example/video/DetectIT.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public class DetectIT {
3838
private ByteArrayOutputStream bout;
3939
private PrintStream out;
4040

41-
static final String LABEL_GCS_LOCATION = "gs://demomaker/cat.mp4";
41+
static final String LABEL_GCS_LOCATION = "gs://cloud-samples-data/video/cat.mp4";
4242
static final String LABEL_FILE_LOCATION = "./resources/cat.mp4";
43-
static final String SHOTS_FILE_LOCATION = "gs://demomaker/gbikes_dinosaur.mp4";
44-
static final String EXPLICIT_CONTENT_LOCATION = "gs://demomaker/cat.mp4";
43+
static final String SHOTS_FILE_LOCATION = "gs://cloud-samples-data/video/gbikes_dinosaur.mp4";
44+
static final String EXPLICIT_CONTENT_LOCATION = "gs://cloud-samples-data/video/cat.mp4";
4545
static final String SPEECH_GCS_LOCATION =
4646
"gs://java-docs-samples-testing/video/googlework_short.mp4";
4747
private static final List<String> POSSIBLE_TEXTS = Arrays.asList(
@@ -106,7 +106,7 @@ public void testSpeechTranscription() throws Exception {
106106

107107
@Test
108108
public void testTrackObjects() throws Exception {
109-
VideoAnnotationResults result = TrackObjects.trackObjects("resources/cat.mp4");
109+
VideoAnnotationResults result = TrackObjects.trackObjects(LABEL_FILE_LOCATION);
110110

111111
boolean textExists = false;
112112
for (ObjectTrackingAnnotation objectTrackingAnnotation : result.getObjectAnnotationsList()) {
@@ -121,7 +121,7 @@ public void testTrackObjects() throws Exception {
121121

122122
@Test
123123
public void testTrackObjectsGcs() throws Exception {
124-
VideoAnnotationResults result = TrackObjects.trackObjectsGcs("gs://demomaker/cat.mp4");
124+
VideoAnnotationResults result = TrackObjects.trackObjectsGcs(LABEL_GCS_LOCATION);
125125

126126
boolean textExists = false;
127127
for (ObjectTrackingAnnotation objectTrackingAnnotation : result.getObjectAnnotationsList()) {

0 commit comments

Comments
 (0)