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

test: improve execution speed of tests #1151

Merged
merged 7 commits into from May 11, 2021
Merged

Conversation

olavloite
Copy link
Collaborator

  • Improves overall test execution time (locally) with approximately 10 seconds.
  • Updates more try-fail-catch to assertThrows

@olavloite olavloite requested a review from a team as a code owner May 10, 2021 18:49
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/java-spanner API. label May 10, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label May 10, 2021
@@ -282,6 +282,10 @@ public static GapicSpannerRpc create(SpannerOptions options) {
}

public GapicSpannerRpc(final SpannerOptions options) {
this(options, true);
Copy link
Collaborator Author

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:

  1. 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.
  2. The initialize and close methods contain an if-statement to check whether to actually initialize / close stubs.

@codecov
Copy link

codecov bot commented May 11, 2021

Codecov Report

Merging #1151 (0340e2f) into master (cd45643) will increase coverage by 0.03%.
The diff coverage is 83.70%.

❗ Current head 0340e2f differs from pull request most recent head f2da9b1. Consider uploading reports for the commit f2da9b1 to get more accurate results
Impacted file tree graph

@@             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              
Impacted Files Coverage Δ Complexity Δ
...m/google/cloud/spanner/spi/v1/GapicSpannerRpc.java 80.77% <83.70%> (+0.57%) 100.00 <1.00> (+3.00)
...le/cloud/spanner/connection/StatementExecutor.java 75.00% <0.00%> (-1.93%) 8.00% <0.00%> (ø%)
...a/com/google/cloud/spanner/SessionPoolOptions.java 67.96% <0.00%> (-1.57%) 18.00% <0.00%> (+1.00%) ⬇️
...ain/java/com/google/cloud/spanner/SessionPool.java 88.55% <0.00%> (ø) 82.00% <0.00%> (+1.00%)
...cloud/spanner/connection/ReadWriteTransaction.java 82.09% <0.00%> (+0.27%) 73.00% <0.00%> (+1.00%)
...gle/cloud/spanner/AsyncTransactionManagerImpl.java 75.71% <0.00%> (+1.42%) 16.00% <0.00%> (+1.00%)
.../cloud/spanner/spi/v1/SpannerErrorInterceptor.java 58.82% <0.00%> (+5.88%) 3.00% <0.00%> (ø%)

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 cd45643...f2da9b1. Read the comment docs.

@olavloite olavloite requested a review from a team as a code owner May 11, 2021 12:20
@thiagotnunes thiagotnunes merged commit 6ce4c2d into master May 11, 2021
@thiagotnunes thiagotnunes deleted the improve-test-performance branch May 11, 2021 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants