Skip to content

Commit

Permalink
use google-cloud-core's MultipleAttemptsRule
Browse files Browse the repository at this point in the history
  • Loading branch information
anguillanneuf committed Mar 10, 2021
1 parent 302d7f7 commit fb6c36e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 86 deletions.
6 changes: 6 additions & 0 deletions samples/install-without-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
<artifactId>protobuf-java-util</artifactId>
<version>3.15.3</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core</artifactId>
<version>1.94.1</version>
<classifier>tests</classifier>
</dependency>
</dependencies>

<!-- compile and run all snippet tests -->
Expand Down
6 changes: 6 additions & 0 deletions samples/snapshot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
<version>1.1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core</artifactId>
<version>1.94.1</version>
<classifier>tests</classifier>
</dependency>
</dependencies>

<!-- compile and run all snippet tests -->
Expand Down
6 changes: 6 additions & 0 deletions samples/snippets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@
<version>1.1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core</artifactId>
<version>1.94.1</version>
<classifier>tests</classifier>
</dependency>
<!-- [END_EXCLUDE] -->
</dependencies>
<!-- [END pubsub_install_with_bom] -->
Expand Down
23 changes: 0 additions & 23 deletions samples/snippets/src/test/java/pubsub/Retry.java

This file was deleted.

54 changes: 0 additions & 54 deletions samples/snippets/src/test/java/pubsub/RetryRule.java

This file was deleted.

11 changes: 2 additions & 9 deletions samples/snippets/src/test/java/pubsub/SchemaIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.cloud.pubsub.v1.SchemaServiceClient;
import com.google.cloud.pubsub.v1.SubscriptionAdminClient;
import com.google.cloud.pubsub.v1.TopicAdminClient;
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
import com.google.pubsub.v1.Encoding;
import com.google.pubsub.v1.ProjectSubscriptionName;
import com.google.pubsub.v1.SchemaName;
Expand All @@ -33,7 +34,6 @@
import java.util.UUID;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.Timeout;
Expand Down Expand Up @@ -74,13 +74,7 @@ private static void requireEnvVar(String varName) {
}

@Rule public Timeout globalTimeout = Timeout.seconds(600); // 10 minute timeout

@Rule public RetryRule retryRule = new RetryRule(3); // Retry 3 times.

@BeforeClass
public static void checkRequirements() {
requireEnvVar("GOOGLE_CLOUD_PROJECT");
}
@Rule public MultipleAttemptsRule retryRule = new MultipleAttemptsRule(/*maxAttemptCount=*/ 3);

@Before
public void setUp() {
Expand Down Expand Up @@ -118,7 +112,6 @@ public void tearDown() throws Exception {
}

@Test
@Retry
public void testSchema() throws Exception {
// Test creating Avro schema.
CreateAvroSchemaExample.createAvroSchemaExample(projectId, avroSchemaId, absoluteAvscFilePath);
Expand Down

0 comments on commit fb6c36e

Please sign in to comment.