Skip to content

Commit 1c0951b

Browse files
nnegreychingor13
authored andcommitted
samples: 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 a806f80 commit 1c0951b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

video/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/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)