Refactor spanner-staging-tests #4017
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4017 +/- ##
============================================
- Coverage 55.70% 55.68% -0.03%
+ Complexity 7237 6782 -455
============================================
Files 1124 1124
Lines 68447 68447
Branches 7721 7721
============================================
- Hits 38130 38116 -14
- Misses 27843 27856 +13
- Partials 2474 2475 +1
🚀 New features to boost your workflow:
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the Spanner staging integration test pipeline to improve environment identification and fix configuration issues. By adjusting how Spanner partitions are handled and correcting JUnit test runners, the changes ensure that integration tests correctly target the intended environments and utilize the appropriate Spanner host configurations. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request cleans up JUnit 4 runner annotations across several integration tests and updates the test categories for CopyDbRandomisedIT. Additionally, in InformationSchemaScannerIT, the instance partition configuration is simplified by defaulting to the "default" partition and changing the region to "nam3". The reviewer recommends using TestProperties.region() instead of hardcoding "nam3" to ensure test portability across different GCP environments.
| SpannerResourceManager.Builder builder = | ||
| SpannerResourceManager.builder( | ||
| testName + "-" + UUID.randomUUID().toString().substring(0, 8), | ||
| projectId, | ||
| "nam6", | ||
| dialect) | ||
| .setInstancePartition(INSTANCE_PARTITION_ID, "nam3"); | ||
| testName + "-" + UUID.randomUUID().toString().substring(0, 8), | ||
| projectId, | ||
| "nam3", | ||
| dialect); |
There was a problem hiding this comment.
Hardcoding the Spanner instance configuration region to "nam3" can cause integration test failures in environments or GCP projects where nam3 is restricted or unavailable (e.g., due to organization policies). To ensure the tests are portable and consistent with setupSharedResourceManagers (which uses TestProperties.region()), we should use TestProperties.region() instead of a hardcoded string.
| SpannerResourceManager.Builder builder = | |
| SpannerResourceManager.builder( | |
| testName + "-" + UUID.randomUUID().toString().substring(0, 8), | |
| projectId, | |
| "nam6", | |
| dialect) | |
| .setInstancePartition(INSTANCE_PARTITION_ID, "nam3"); | |
| testName + "-" + UUID.randomUUID().toString().substring(0, 8), | |
| projectId, | |
| "nam3", | |
| dialect); | |
| SpannerResourceManager.Builder builder = | |
| SpannerResourceManager.builder( | |
| testName + "-" + UUID.randomUUID().toString().substring(0, 8), | |
| projectId, | |
| TestProperties.region(), | |
| dialect); |
b/534589929
This PR refactors the Spanner staging integration test pipeline to dynamically change the run-name to different testing environments (Production, Staging, Cloud-devel).
Changes and Intent
1. Added a dynamic
run-nameexpression in.github/workflows/spanner-staging-tests.ymlBecause this workflow runs against three different Spanner hosts (Prod, Staging, Cloud-devel), distinguishing the runs in the GitHub Actions UI was difficult. Test runs will now clearly identify their target environment (e.g., "Spanner Cloud-devel Integration Tests").
2. Removed the explicit
spannerHostinput configuration from thepull_requestblock to avoid masking defaultspull_requesttriggers don't accept theinputsparameter - so the workflow that this PR triggered had no Spanner host set, which is incorrect. (Workflow link)envblock to rectify this issue3. Removed
@RunWith(JUnit4.class)from CobyDbIT and CopyDbRandomisedIT test files4. Changed
PARTITION_IDtodefaultinstead of creating a new one"default"that shares the instance's region configuration.nam3), and the custom partition must be created in a different configuration (e.g.,nam6).Tests
https://screenshot.googleplex.com/4Ew96Vt3ckq9mnh.png
https://screenshot.googleplex.com/5YA3kPQctVuYCps.png