Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 8, 2026. It is now read-only.

samples(testing): add retry rule#565

Merged
anguillanneuf merged 2 commits into
mastergoogleapis/java-pubsub:masterfrom
samples-flakygoogleapis/java-pubsub:samples-flakyCopy head branch name to clipboard
Mar 10, 2021
Merged

samples(testing): add retry rule#565
anguillanneuf merged 2 commits into
mastergoogleapis/java-pubsub:masterfrom
samples-flakygoogleapis/java-pubsub:samples-flakyCopy head branch name to clipboard

Conversation

@anguillanneuf

@anguillanneuf anguillanneuf commented Mar 9, 2021

Copy link
Copy Markdown
Contributor

Fixes #552

I referenced: https://www.lenar.io/how-to-re-run-failed-tests-junit/

Alternatively, upgrade to junit5 and use @RepeatedTest annotation: https://www.swtestacademy.com/junit-5-how-to-repeat-failed-test/ ← Not super useful because it retries successful runs.

Also tried

    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>google-cloud-core</artifactId>
      <version>1.94.3</version>
    </dependency>

But unable to import com.google.cloud.testing.junit4.MultipleAttemptsRule;

Turned out that I need <classifier>tests</classifier> tag.

@anguillanneuf anguillanneuf requested a review from a team March 9, 2021 22:34
@product-auto-label product-auto-label Bot added api: pubsub Issues related to the googleapis/java-pubsub API. samples Issues that are directly related to samples. labels Mar 9, 2021
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Mar 9, 2021
@codecov

codecov Bot commented Mar 9, 2021

Copy link
Copy Markdown

Codecov Report

Merging #565 (fb6c36e) into master (0dd6d2d) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #565   +/-   ##
=========================================
  Coverage     78.73%   78.73%           
  Complexity      378      378           
=========================================
  Files            27       27           
  Lines          3418     3418           
  Branches        171      171           
=========================================
  Hits           2691     2691           
  Misses          653      653           
  Partials         74       74           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0dd6d2d...fb6c36e. Read the comment docs.

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BenWhitehead could we use the junit rules you wrote here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

junit5 has a @RepeatedTest annotation if we can upgrade?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, let me clarify here :) @BenWhitehead worked on some shared JUnit rules in java-core, wondering if we can make use of them - https://github.com/googleapis/java-core/pull/327/files. @anguillanneuf let me know if these are a good fit for what you're trying to accomplish, otherwise feel free to ignore my suggestion :)

@anguillanneuf anguillanneuf Mar 9, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/googleapis/java-core/blob/master/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/MultipleAttemptsRule.java is what I need, but it's in src/test/, is that something I can import?

Do you know if we can use this for testing?

 <dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-engine</artifactId>
    <version>5.7.1</version>
    <scope>test</scope>
</dependency>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I tried junit5, but the RepeatedTest annotation naively retries even if test succeeds. I reverted my changes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aren't using Junit 5 yet, I don't remember the reason why, ask at Java Samples Office Hours. (I think it's reasonable to upgrade, but it's also a huge effort - perhaps we can just do it one at a time)

@anguillanneuf anguillanneuf requested review from a team March 9, 2021 23:34
@generated-files-bot

Copy link
Copy Markdown

Warning: This pull request is touching the following templated files:

  • samples/install-without-bom/pom.xml
  • samples/snapshot/pom.xml
  • samples/snippets/pom.xml

@anguillanneuf anguillanneuf requested a review from kolea2 March 9, 2021 23:37
@anguillanneuf anguillanneuf removed the request for review from a team March 10, 2021 19:48
Comment thread samples/snippets/src/test/java/pubsub/SchemaIT.java
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: pubsub Issues related to the googleapis/java-pubsub API. cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pubsub.SchemaIT: testSchema failed

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.