Skip to content

Revived CopyDbTest#3926

Open
darshan-sj wants to merge 3 commits into
GoogleCloudPlatform:mainfrom
darshan-sj:copyDbIT
Open

Revived CopyDbTest#3926
darshan-sj wants to merge 3 commits into
GoogleCloudPlatform:mainfrom
darshan-sj:copyDbIT

Conversation

@darshan-sj

Copy link
Copy Markdown
Contributor

No description provided.

@darshan-sj darshan-sj requested a review from a team as a code owner June 17, 2026 08:49
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 modernizes the integration testing suite for Spanner export and import pipelines. By replacing the monolithic CopyDbTest with a modular CopyDbIT class and introducing a dedicated utility for schema generation, the changes improve test readability, dialect support, and overall maintainability of the integration test suite.

Highlights

  • Integration Test Migration: Replaced the legacy CopyDbTest with a modern CopyDbIT integration test, improving maintainability and test structure.
  • Schema Generation Utilities: Introduced SchemaGenerationUtils to centralize DDL generation logic for both Google Standard SQL and PostgreSQL dialects.
  • Codebase Improvements: Updated TemplateTestBase and SpannerResourceManager to support more flexible test configurations and dynamic DDL handling.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request migrates the Spanner export/import integration tests from CopyDbTest to a new CopyDbIT class, utilizing the TemplateTestBase framework. It also introduces SchemaGenerationUtils to help construct test schemas for both Google Standard SQL and PostgreSQL dialects, and updates RandomDdlGenerator to handle dialect-specific quoting in filters. The reviewer noted that several helper methods in SchemaGenerationUtils (such as those for empty tables and foreign keys) are currently unused in CopyDbIT, which represents a regression in test coverage compared to the original test suite. It is recommended to add corresponding test cases to cover these scenarios.

Comment on lines +260 to +271
public void testEmptyDbGsql() throws Exception {
Ddl ddl = Ddl.builder(Dialect.GOOGLE_STANDARD_SQL).build();
createAndPopulate(ddl, 0);
runTest(Dialect.GOOGLE_STANDARD_SQL);
}

@Test
public void testEmptyDbPg() throws Exception {
Ddl ddl = Ddl.builder(Dialect.POSTGRESQL).build();
createAndPopulate(ddl, 0);
runTest(Dialect.POSTGRESQL);
}

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.

medium

The helper methods addEmptyTables, addPgEmptyTables, addForeignKeys, and addPgForeignKeys in SchemaGenerationUtils are defined but never used in CopyDbIT. The original CopyDbTest had dedicated test cases for empty tables and foreign keys (e.g., emptyTables, emptyPgTables, foreignKeys, pgForeignKeys). To prevent a regression in integration test coverage for the Spanner import/export templates, please add corresponding test cases in CopyDbIT that utilize these helper methods.

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.57%. Comparing base (65d422a) to head (bf20543).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../java/org/apache/beam/it/gcp/TemplateTestBase.java 0.00% 3 Missing ⚠️
...he/beam/it/gcp/spanner/SpannerResourceManager.java 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3926      +/-   ##
============================================
- Coverage     55.59%   55.57%   -0.02%     
+ Complexity     7052     7049       -3     
============================================
  Files          1103     1103              
  Lines         67681    67684       +3     
  Branches       7603     7603              
============================================
- Hits          37625    37616       -9     
- Misses        27636    27646      +10     
- Partials       2420     2422       +2     
Components Coverage Δ
spanner-templates 88.48% <ø> (-0.02%) ⬇️
spanner-import-export 68.67% <ø> (-0.04%) ⬇️
spanner-live-forward-migration 90.23% <ø> (-0.02%) ⬇️
spanner-live-reverse-replication 84.41% <ø> (-0.03%) ⬇️
spanner-bulk-migration 92.62% <ø> (-0.01%) ⬇️
gcs-spanner-dv 88.88% <ø> (-0.02%) ⬇️
Files with missing lines Coverage Δ
...he/beam/it/gcp/spanner/SpannerResourceManager.java 73.49% <0.00%> (-0.27%) ⬇️
.../java/org/apache/beam/it/gcp/TemplateTestBase.java 0.00% <0.00%> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

columns.endIndexColumn();
if (rnd.nextBoolean()) {
filters.add("\"" + columnName + "\" IS NOT NULL");
String q = getDialect() == Dialect.POSTGRESQL ? "\"" : "`";

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.

Please add parentheses for readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants