Skip to content

Commit

Permalink
samples: Flaky test fix (#1490)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nnegrey authored and chingor13 committed Feb 24, 2021
1 parent a806f80 commit 1c0951b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void main(String[] args) throws Exception {
// Instantiate a video intelligence client
try (VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create()) {
// The Google Cloud Storage path to the video to annotate.
String gcsUri = "gs://demomaker/cat.mp4";
String gcsUri = "gs://cloud-samples-data/video/cat.mp4";

// Create an operation that will contain the response when the operation completes.
AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder()
Expand Down
10 changes: 5 additions & 5 deletions video/src/test/java/com/example/video/DetectIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class DetectIT {
private ByteArrayOutputStream bout;
private PrintStream out;

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

@Test
public void testTrackObjects() throws Exception {
VideoAnnotationResults result = TrackObjects.trackObjects("resources/cat.mp4");
VideoAnnotationResults result = TrackObjects.trackObjects(LABEL_FILE_LOCATION);

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

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

boolean textExists = false;
for (ObjectTrackingAnnotation objectTrackingAnnotation : result.getObjectAnnotationsList()) {
Expand Down

0 comments on commit 1c0951b

Please sign in to comment.