Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples(testing): add retry rule #565

Merged
merged 2 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
9 changes: 4 additions & 5 deletions samples/snippets/src/main/java/utilities/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
/**
* This file is created using Avro tools.
*
* To download, visit https://avro.apache.org/releases.html#Download
* <p>To download, visit https://avro.apache.org/releases.html#Download
*
* Run the following command from the `samples/snippets` directory to
* generate this class:
* <p>Run the following command from the `samples/snippets` directory to generate this class:
*
*`java -jar /location/to/your/avro-tools-1.10.1.jar compile schema src/main/resources/us-states.avsc src/main/java/`
* <p>`java -jar /location/to/your/avro-tools-1.10.1.jar compile schema
* src/main/resources/us-states.avsc src/main/java/`
*/

package utilities;

import org.apache.avro.message.BinaryMessageDecoder;
Expand Down
9 changes: 4 additions & 5 deletions samples/snippets/src/main/java/utilities/StateProto.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
/**
* This file is created using protoc.
*
* To download, visit https://developers.google.com/protocol-buffers/docs/downloads
* <p>To download, visit https://developers.google.com/protocol-buffers/docs/downloads
*
* Run the following command from the `samples/snippets` directory to
* generate this class:
* <p>Run the following command from the `samples/snippets` directory to generate this class:
*
*`protoc --proto_path=src/main/resources/ --java_out=src/main/java/ src/main/resources/us-states.proto`
* <p>`protoc --proto_path=src/main/resources/ --java_out=src/main/java/
* src/main/resources/us-states.proto`
*/

package utilities;

public final class StateProto {
Expand Down
10 changes: 3 additions & 7 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 @@ -73,12 +73,8 @@ private static void requireEnvVar(String varName) {
System.getenv(varName));
}

@Rule public Timeout globalTimeout = Timeout.seconds(300); // 5 minute timeout

@BeforeClass
anguillanneuf marked this conversation as resolved.
Show resolved Hide resolved
public static void checkRequirements() {
requireEnvVar("GOOGLE_CLOUD_PROJECT");
}
@Rule public Timeout globalTimeout = Timeout.seconds(600); // 10 minute timeout
@Rule public MultipleAttemptsRule retryRule = new MultipleAttemptsRule(/*maxAttemptCount=*/ 3);

@Before
public void setUp() {
Expand Down