Skip to content

Commit 73e9da2

Browse files
authored
test: add MultipleAttemptsRule to failing Compute tests (GoogleCloudPlatform#7498)
* test: add MultipleAttemptsRule to FirewallIT * linting * test: add retries to failing snippet IT
1 parent df91a41 commit 73e9da2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

compute/cloud-client/src/test/java/compute/FirewallIT.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.google.api.gax.rpc.InvalidArgumentException;
2323
import com.google.api.gax.rpc.NotFoundException;
2424
import com.google.cloud.compute.v1.FirewallsClient;
25+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
2526
import java.io.ByteArrayOutputStream;
2627
import java.io.IOException;
2728
import java.io.PrintStream;
@@ -30,6 +31,7 @@
3031
import java.util.concurrent.TimeUnit;
3132
import java.util.concurrent.TimeoutException;
3233
import org.junit.Assert;
34+
import org.junit.Rule;
3335
import org.junit.jupiter.api.AfterAll;
3436
import org.junit.jupiter.api.AfterEach;
3537
import org.junit.jupiter.api.BeforeAll;
@@ -42,6 +44,7 @@
4244
@RunWith(JUnit4.class)
4345
@Timeout(value = 10, unit = TimeUnit.MINUTES)
4446
public class FirewallIT {
47+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
4548

4649
private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
4750
private static String FIREWALL_RULE_CREATE;

compute/cloud-client/src/test/java/compute/SnippetsIT.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.google.cloud.storage.BucketInfo;
3131
import com.google.cloud.storage.Storage;
3232
import com.google.cloud.storage.StorageOptions;
33+
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
3334
import java.io.ByteArrayOutputStream;
3435
import java.io.IOException;
3536
import java.io.PrintStream;
@@ -38,6 +39,7 @@
3839
import java.util.concurrent.TimeUnit;
3940
import java.util.concurrent.TimeoutException;
4041
import org.junit.Assert;
42+
import org.junit.Rule;
4143
import org.junit.jupiter.api.AfterAll;
4244
import org.junit.jupiter.api.AfterEach;
4345
import org.junit.jupiter.api.BeforeAll;
@@ -50,6 +52,7 @@
5052
@RunWith(JUnit4.class)
5153
@Timeout(value = 10, unit = TimeUnit.MINUTES)
5254
public class SnippetsIT {
55+
@Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
5356

5457
private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
5558
private static String ZONE;

0 commit comments

Comments
 (0)