-
Notifications
You must be signed in to change notification settings - Fork 101
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
test: improve execution speed of tests #1151
Conversation
olavloite
commented
May 10, 2021
- Improves overall test execution time (locally) with approximately 10 seconds.
- Updates more try-fail-catch to assertThrows
@@ -282,6 +282,10 @@ public static GapicSpannerRpc create(SpannerOptions options) { | |||
} | |||
|
|||
public GapicSpannerRpc(final SpannerOptions options) { | |||
this(options, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in this file look very big (on GitHub), but are in reality quite small:
- An additional package-private constructor for test purposes has been added that allows creating a
GapicSpannerRpc
without creating and initializing the gRPC stubs. This allows testing methods that do not communicate with any backend without the need to setup a mock server, and without the additional execution time of initializing and closing the stubs. - The initialize and close methods contain an if-statement to check whether to actually initialize / close stubs.
google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java
Outdated
Show resolved
Hide resolved
google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java
Outdated
Show resolved
Hide resolved
google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java
Outdated
Show resolved
Hide resolved
google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnInvalidatedSessionTest.java
Outdated
Show resolved
Hide resolved
...-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AbstractMockServerTest.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #1151 +/- ##
============================================
+ Coverage 84.86% 84.89% +0.03%
- Complexity 2762 2769 +7
============================================
Files 156 156
Lines 14318 14331 +13
Branches 1377 1379 +2
============================================
+ Hits 12151 12167 +16
+ Misses 1596 1593 -3
Partials 571 571
Continue to review full report at Codecov.
|