Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Added tests for gRPC retries. #69

Merged
merged 10 commits into from
Nov 13, 2015

Conversation

deflaux
Copy link
Contributor

@deflaux deflaux commented Nov 9, 2015

The main code changed a bit to make it easier to pass in the channel created by the AbstractTransportTest but otherwise this is mostly new tests.

Added:

  • unit tests for shard boundaries (previously there were only integration tests)
  • unit tests for retries
  • integration tests for retries
  • and a long running integration test for retries

@@ -140,6 +140,12 @@
<artifactId>grpc-all</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-interop-testing</artifactId>
Copy link

Choose a reason for hiding this comment

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

You really shouldn't depend on grpc-interop-testing; it's only there for people to run the interop clients if they want. It shouldn't be hard to remove the dependency of AbstractTransportTest.

@deflaux
Copy link
Contributor Author

deflaux commented Nov 10, 2015

@ejona86 PTAL


protected static class VariantsIntegrationServerImpl implements
StreamingVariantServiceGrpc.StreamingVariantService {
final Random random = new Random();
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like you should be using a seed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its intentional for these integration tests --> it will be a slightly different test every time but all runs should pass regardless of differences in the sequence of faults injected within the transfer.

I'm testing fixed sequences of faults in the unit tests.

Sound okay to you?

Copy link
Contributor

Choose a reason for hiding this comment

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

If the probability of failure due to simulated failure is very low, I guess this is fine. I'd still prefer seeded random values if this is being run on the continuous integration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Travis CI is currently running the unit tests but not the integration tests. The integration tests are run as part of the release process and also on demand.

On a separate note, I had a flaky unit test because I was not adequately protecting the variables controlling the retry behavior from the channel and service threads interacting with them. With that fix, I think this PR is now good to go, but please let me know if there are any other changes you would like to see in this PR? Thanks!

/**
* A convenience class for creating gRPC channels to the Google Genomics API.
*/
public class GenomicsChannel extends Channel {
public class GenomicsChannel extends ManagedChannel {
Copy link

Choose a reason for hiding this comment

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

I wouldn't suggest you to implement ManagedChannel. You can keep the factory methods, but I would suggest they just return a ManagedChannel.

Copy link

Choose a reason for hiding this comment

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

I didn't see any public non-static methods. Did you make this class thinking you might add some in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question Eric. I made this class when we needed to expose shutdown for the hangs 042a406 ManagedChannel did not exist at that time, only ChanneImpl.

I'll refactor now - thanks.

Copy link

Choose a reason for hiding this comment

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

Oh, before you could add interceptors via the ChannelBuilder. That makes sense.

Now that we are using ManagedChannel instead of ChannelImpl.
@deflaux
Copy link
Contributor Author

deflaux commented Nov 13, 2015

@ejona86 Thanks for the feedback! Please let me know if there are any other changes you would like to see in this PR.

@ejona86
Copy link

ejona86 commented Nov 13, 2015

@deflaux I didn't see anything else to point out.

@calbach
Copy link
Contributor

calbach commented Nov 13, 2015

LGTM

Sidenote: could we file an issue to have an automated style cleanup over this repo? There was a lot of noise added to this PR due to style-only changes (presumably from your IDE) which made this harder to review.

deflaux added a commit that referenced this pull request Nov 13, 2015
@deflaux deflaux merged commit 711c10a into googlegenomics:retry-grpc-stream Nov 13, 2015
@deflaux
Copy link
Contributor Author

deflaux commented Nov 13, 2015

Filed #70

@deflaux deflaux mentioned this pull request Nov 13, 2015
@deflaux deflaux deleted the retry-grpc-stream branch November 23, 2015 18:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants