Skip to content

Commit b5bed02

Browse files
authored
test: add retries to media tests (GoogleCloudPlatform#7660)
* docs(samples): add retries to Transcoder and Video Stitcher tests * formatting
1 parent e54f9fd commit b5bed02

39 files changed

+127
-3
lines changed

media/stitcher/src/test/java/com/example/stitcher/CreateCdnKeyAkamaiTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,22 @@
2121
import static org.junit.Assert.assertNotNull;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2425
import java.io.ByteArrayOutputStream;
2526
import java.io.IOException;
2627
import java.io.PrintStream;
2728
import org.junit.After;
2829
import org.junit.Before;
2930
import org.junit.BeforeClass;
31+
import org.junit.Rule;
3032
import org.junit.Test;
3133
import org.junit.runner.RunWith;
3234
import org.junit.runners.JUnit4;
3335

3436
@RunWith(JUnit4.class)
3537
public class CreateCdnKeyAkamaiTest {
3638

39+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5);
3740
private static final String LOCATION = "us-central1";
3841
private static final String AKAMAI_KEY_ID = TestUtils.getCdnKeyId();
3942
private static final String HOSTNAME = "cdn.example.com";

media/stitcher/src/test/java/com/example/stitcher/CreateCdnKeyTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,22 @@
2121
import static org.junit.Assert.assertNotNull;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2425
import java.io.ByteArrayOutputStream;
2526
import java.io.IOException;
2627
import java.io.PrintStream;
2728
import org.junit.After;
2829
import org.junit.Before;
2930
import org.junit.BeforeClass;
31+
import org.junit.Rule;
3032
import org.junit.Test;
3133
import org.junit.runner.RunWith;
3234
import org.junit.runners.JUnit4;
3335

3436
@RunWith(JUnit4.class)
3537
public class CreateCdnKeyTest {
3638

39+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5);
3740
private static final String LOCATION = "us-central1";
3841
private static final String CLOUD_CDN_KEY_ID = TestUtils.getCdnKeyId();
3942
private static final String MEDIA_CDN_KEY_ID = TestUtils.getCdnKeyId();

media/stitcher/src/test/java/com/example/stitcher/CreateLiveSessionTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,22 @@
2121
import static org.junit.Assert.assertNotNull;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2425
import java.io.ByteArrayOutputStream;
2526
import java.io.IOException;
2627
import java.io.PrintStream;
2728
import org.junit.After;
2829
import org.junit.Before;
2930
import org.junit.BeforeClass;
31+
import org.junit.Rule;
3032
import org.junit.Test;
3133
import org.junit.runner.RunWith;
3234
import org.junit.runners.JUnit4;
3335

3436
@RunWith(JUnit4.class)
3537
public class CreateLiveSessionTest {
3638

39+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5);
3740
private static final String LOCATION = "us-central1";
3841
private static final String LIVE_URI =
3942
"https://storage.googleapis.com/cloud-samples-data/media/hls-live/manifest.m3u8";

media/stitcher/src/test/java/com/example/stitcher/CreateSlateTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,22 @@
2121
import static org.junit.Assert.assertNotNull;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2425
import java.io.ByteArrayOutputStream;
2526
import java.io.IOException;
2627
import java.io.PrintStream;
2728
import org.junit.After;
2829
import org.junit.Before;
2930
import org.junit.BeforeClass;
31+
import org.junit.Rule;
3032
import org.junit.Test;
3133
import org.junit.runner.RunWith;
3234
import org.junit.runners.JUnit4;
3335

3436
@RunWith(JUnit4.class)
3537
public class CreateSlateTest {
3638

39+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5);
3740
private static final String LOCATION = "us-central1";
3841
private static final String SLATE_ID = TestUtils.getSlateId();
3942
private static final String SLATE_URI =

media/stitcher/src/test/java/com/example/stitcher/CreateVodSessionTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,22 @@
2020
import static org.hamcrest.MatcherAssert.assertThat;
2121
import static org.junit.Assert.assertNotNull;
2222

23+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2324
import java.io.ByteArrayOutputStream;
2425
import java.io.IOException;
2526
import java.io.PrintStream;
2627
import org.junit.After;
2728
import org.junit.Before;
2829
import org.junit.BeforeClass;
30+
import org.junit.Rule;
2931
import org.junit.Test;
3032
import org.junit.runner.RunWith;
3133
import org.junit.runners.JUnit4;
3234

3335
@RunWith(JUnit4.class)
3436
public class CreateVodSessionTest {
3537

38+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5);
3639
private static final String LOCATION = "us-central1";
3740
private static final String VOD_URI =
3841
"https://storage.googleapis.com/cloud-samples-data/media/hls-vod/manifest.m3u8";

media/stitcher/src/test/java/com/example/stitcher/DeleteCdnKeyTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,22 @@
2121
import static org.junit.Assert.assertNotNull;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2425
import java.io.ByteArrayOutputStream;
2526
import java.io.IOException;
2627
import java.io.PrintStream;
2728
import org.junit.After;
2829
import org.junit.Before;
2930
import org.junit.BeforeClass;
31+
import org.junit.Rule;
3032
import org.junit.Test;
3133
import org.junit.runner.RunWith;
3234
import org.junit.runners.JUnit4;
3335

3436
@RunWith(JUnit4.class)
3537
public class DeleteCdnKeyTest {
3638

39+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5);
3740
private static final String LOCATION = "us-central1";
3841
private static final String CLOUD_CDN_KEY_ID = TestUtils.getCdnKeyId();
3942
private static final String MEDIA_CDN_KEY_ID = TestUtils.getCdnKeyId();

media/stitcher/src/test/java/com/example/stitcher/DeleteSlateTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,22 @@
2121
import static org.junit.Assert.assertNotNull;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2425
import java.io.ByteArrayOutputStream;
2526
import java.io.IOException;
2627
import java.io.PrintStream;
2728
import org.junit.After;
2829
import org.junit.Before;
2930
import org.junit.BeforeClass;
31+
import org.junit.Rule;
3032
import org.junit.Test;
3133
import org.junit.runner.RunWith;
3234
import org.junit.runners.JUnit4;
3335

3436
@RunWith(JUnit4.class)
3537
public class DeleteSlateTest {
3638

39+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5);
3740
private static final String LOCATION = "us-central1";
3841
private static final String SLATE_ID = TestUtils.getSlateId();
3942
private static final String SLATE_URI =

media/stitcher/src/test/java/com/example/stitcher/GetCdnKeyTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,22 @@
2121
import static org.junit.Assert.assertNotNull;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2425
import java.io.ByteArrayOutputStream;
2526
import java.io.IOException;
2627
import java.io.PrintStream;
2728
import org.junit.After;
2829
import org.junit.Before;
2930
import org.junit.BeforeClass;
31+
import org.junit.Rule;
3032
import org.junit.Test;
3133
import org.junit.runner.RunWith;
3234
import org.junit.runners.JUnit4;
3335

3436
@RunWith(JUnit4.class)
3537
public class GetCdnKeyTest {
3638

39+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5);
3740
private static final String LOCATION = "us-central1";
3841
private static final String CLOUD_CDN_KEY_ID = TestUtils.getCdnKeyId();
3942
private static final String MEDIA_CDN_KEY_ID = TestUtils.getCdnKeyId();

media/stitcher/src/test/java/com/example/stitcher/GetLiveAdTagDetailTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static org.junit.Assert.assertNotNull;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2425
import java.io.ByteArrayOutputStream;
2526
import java.io.IOException;
2627
import java.io.PrintStream;
@@ -29,13 +30,15 @@
2930
import org.junit.After;
3031
import org.junit.Before;
3132
import org.junit.BeforeClass;
33+
import org.junit.Rule;
3234
import org.junit.Test;
3335
import org.junit.runner.RunWith;
3436
import org.junit.runners.JUnit4;
3537

3638
@RunWith(JUnit4.class)
3739
public class GetLiveAdTagDetailTest {
3840

41+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5);
3942
private static final String LOCATION = "us-central1";
4043
private static final String LIVE_URI =
4144
"https://storage.googleapis.com/cloud-samples-data/media/hls-live/manifest.m3u8";

media/stitcher/src/test/java/com/example/stitcher/GetLiveSessionTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static org.junit.Assert.assertNotNull;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2425
import java.io.ByteArrayOutputStream;
2526
import java.io.IOException;
2627
import java.io.PrintStream;
@@ -29,13 +30,15 @@
2930
import org.junit.After;
3031
import org.junit.Before;
3132
import org.junit.BeforeClass;
33+
import org.junit.Rule;
3234
import org.junit.Test;
3335
import org.junit.runner.RunWith;
3436
import org.junit.runners.JUnit4;
3537

3638
@RunWith(JUnit4.class)
3739
public class GetLiveSessionTest {
3840

41+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(5);
3942
private static final String LOCATION = "us-central1";
4043
private static final String LIVE_URI =
4144
"https://storage.googleapis.com/cloud-samples-data/media/hls-live/manifest.m3u8";

0 commit comments

Comments
 (0)