Skip to content

Conversation

@nmemond
Copy link
Contributor

@nmemond nmemond commented Dec 23, 2025

This adds integration tests to check data type mappings when doing a live migration from PostgreSQL to Spanner for both dialects.

Note that some of the type mappings fail to migrate as expected. The checks for those are still included for completeness, but they're ignored to avoid failing the tests.

@nmemond nmemond requested a review from a team as a code owner December 23, 2025 20:20
@gemini-code-assist
Copy link

Summary of Changes

Hello @nmemond, 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 significantly enhances the testing framework for the 'DataStreamToSpanner' Flex template by introducing dedicated integration tests for PostgreSQL data type migration. The tests are designed to validate how various PostgreSQL data types are mapped and transferred to both standard and PostgreSQL dialect Spanner databases during a live migration. This ensures the reliability and correctness of data transformations, with a pragmatic approach to handle currently unsupported types without blocking the test suite.

Highlights

  • Comprehensive Data Type Testing: New integration tests have been added to thoroughly check the mapping and migration of a wide array of PostgreSQL data types to Spanner.
  • Dual Dialect Support: The tests cover both standard Spanner and PostgreSQL dialect Spanner, ensuring compatibility across different Spanner configurations.
  • Graceful Handling of Unsupported Types: Known unsupported data type mappings are explicitly ignored in the tests to prevent failures, while still being tracked for completeness.
  • Enhanced SQL Script Execution: The base test utility now supports executing 'SELECT' statements within SQL scripts, which is crucial for managing replication slots during testing.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.74%. Comparing base (1d3183c) to head (42435e7).
⚠️ Report is 31 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3152      +/-   ##
============================================
+ Coverage     50.78%   54.74%   +3.96%     
+ Complexity     5103     2241    -2862     
============================================
  Files           975      490     -485     
  Lines         59984    28431   -31553     
  Branches       6552     2994    -3558     
============================================
- Hits          30461    15565   -14896     
+ Misses        27380    11921   -15459     
+ Partials       2143      945    -1198     
Components Coverage Δ
spanner-templates 72.17% <ø> (+1.21%) ⬆️
spanner-import-export ∅ <ø> (∅)
spanner-live-forward-migration 80.08% <ø> (+0.04%) ⬆️
spanner-live-reverse-replication 77.75% <ø> (+0.15%) ⬆️
spanner-bulk-migration 88.43% <ø> (-0.07%) ⬇️
see 515 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.

@VardhanThigle
Copy link
Contributor

Failure in asserts

pool-1-thread-60] INFO com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT - Asserting type: boolean_to_string
[pool-1-thread-60] INFO org.apache.beam.it.gcp.spanner.SpannerResourceManager - Loading columns [id, col] from teleport3.testpos_20251225_064337_vk3rlh.t_boolean_to_string
[pool-1-thread-60] INFO org.apache.beam.it.gcp.spanner.SpannerResourceManager - Loaded 3 records from teleport3.testpos_20251225_064337_vk3rlh.t_boolean_to_string
[pool-1-thread-60] INFO com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT - Found row: [1, false]
[pool-1-thread-60] INFO com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT - Found row: [2, true]
[pool-1-thread-60] INFO com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT - Found row: [3, null]
[pool-1-thread-60] INFO com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT - Asserting type: json_to_string
[pool-1-thread-60] INFO org.apache.beam.it.gcp.spanner.SpannerResourceManager - Loading columns [id, col] from teleport3.testpos_20251225_064337_vk3rlh.t_json_to_string
[pool-1-thread-60] INFO org.apache.beam.it.gcp.spanner.SpannerResourceManager - Loaded 3 records from teleport3.testpos_20251225_064337_vk3rlh.t_json_to_string
[pool-1-thread-60] INFO com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT - Found row: [1, {"duplicate_key": 2}]
[pool-1-thread-60] INFO com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT - Found row: [2, {"null_key": null}]
[pool-1-thread-60] INFO com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT - Found row: [3, null]
Error:  Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 1,665.32 s <<< FAILURE! - in com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT
[INFO] Running com.google.cloud.teleport.v2.templates.SeparateShadowTableDatabaseStringOverridesIT
[pool-1-thread-38] INFO org.apache.beam.it.gcp.TemplateTestBase - Starting integration test com.google.cloud.teleport.v2.templates.SeparateShadowTableDatabaseStringOverridesIT.migrationTestWithRenameTableAndColumns
Dec 25, 2025 6:40:23 AM com.google.api.client.googleapis.services.AbstractGoogleClient <init>
WARNING: Application name is not set. Call Builder#setApplicationName.
[pool-1-thread-38] INFO org.apache.beam.it.gcp.spanner.SpannerResourceManager - Not creating Spanner instance - reusing static teleport2
[pool-1-thread-38] INFO org.apache.beam.it.gcp.spanner.SpannerResourceManager - Creating database shadow__20251225_064337_z9eumg in instance teleport2.

@nmemond nmemond force-pushed the pg-data-type-tests-live branch from 1505c37 to b720ad6 Compare January 2, 2026 17:03
@VardhanThigle
Copy link
Contributor

VardhanThigle commented Jan 6, 2026

There seems to be a Assert in matching

PostgreSQLDatastreamToSpannerDataTypesIT.testPostgreSqlDataTypes

expected that contains unordered record (and case insensitive) {COL={"duplicate_key":1}, ID=1}, but only had [{col={"duplicate_key":2}, id=1}, {col={"null_key":null}, id=2}, {col=NULL, id=3}]
	at com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT.validateResult(PostgreSQLDatastreamToSpannerDataTypesIT.java:372)
	at com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT.testPostgreSqlDataTypes(PostgreSQLDatastreamToSpannerDataTypesIT.java:263)

PostgreSQLDatastreamToSpannerDataTypesIT.testPostgreSqlDataTypesPGDialect

expected that contains unordered record (and case insensitive) {COL=08:00:2b:01:02:03:04:05, ID=1}, but only had [{col=NULL, id=1}, {col=NULL, id=2}]
	at com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT.validateResult(PostgreSQLDatastreamToSpannerDataTypesIT.java:372)
	at com.google.cloud.teleport.v2.templates.PostgreSQLDatastreamToSpannerDataTypesIT.testPostgreSqlDataTypesPGDialect(PostgreSQLDatastreamToSpannerDataTypesIT.java:311)

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.

3 participants