Skip to content

Add oracle bulk ITs - #4161

Open
dhwanilpatel wants to merge 8 commits into
GoogleCloudPlatform:mainfrom
dhwanilpatel:oracle_bulk_simple_it
Open

Add oracle bulk ITs#4161
dhwanilpatel wants to merge 8 commits into
GoogleCloudPlatform:mainfrom
dhwanilpatel:oracle_bulk_simple_it

Conversation

@dhwanilpatel

@dhwanilpatel dhwanilpatel commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Adding Oracle ITs for bulk template.

@dhwanilpatel
dhwanilpatel requested a review from a team as a code owner August 19, 2026 11:00
@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 adds support for Oracle database integration testing within the SourceDbToSpanner template. It includes the necessary infrastructure in the base test class to manage Oracle resources and introduces a new integration test to validate the migration pipeline using a simple schema.

Highlights

  • Oracle Integration Test Support: Added OracleResourceManager support to SourceDbToSpannerITBase to enable integration testing with Oracle databases.
  • New Integration Test: Introduced OracleSourceDbToSpannerSimpleIT to verify basic migration functionality from Oracle to Spanner.
  • Configuration Updates: Updated SourceDbToSpannerITBase to handle Oracle-specific SQL dialect, driver class, and namespace configuration.
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 introduces Oracle database support to the SourceDbToSpanner integration tests, including helper methods in the base class and a new simple integration test OracleSourceDbToSpannerSimpleIT. Feedback focuses on preventing resource leaks in database connections by using try-with-resources, avoiding shaded imports, removing unused fields, and converting static test fields to instance variables to prevent shared state issues.

Comment on lines +89 to +110
try {
Connection connection =
DriverManager.getConnection(
jdbcResourceManager.getUri(),
jdbcResourceManager.getUsername(),
jdbcResourceManager.getPassword());

// Preprocess SQL to handle multi-line statements and newlines
sql = sql.replaceAll("\r\n", " ").replaceAll("\n", " ");

// Split into individual statements based on -- SPLIT --
String[] statements = sql.split("-- SPLIT --");

// Execute each statement
Statement statement = connection.createStatement();
for (String stmt : statements) {
if (!stmt.trim().isEmpty()) {
LOG.info("Executing Oracle statement: {}", stmt);
statement.executeUpdate(stmt);
}
}
} catch (Exception e) {

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.

high

The Connection and Statement resources are opened but never closed, which causes a resource leak. Use a try-with-resources block to ensure they are properly closed after execution. Additionally, using DriverManager.getConnection directly is preferred for obtaining single, short-lived database connections to avoid leaking connection pools.

    try (Connection connection =
            DriverManager.getConnection(
                jdbcResourceManager.getUri(),
                jdbcResourceManager.getUsername(),
                jdbcResourceManager.getPassword());
        Statement statement = connection.createStatement()) {

      // Preprocess SQL to handle multi-line statements and newlines
      String preprocessedSql = sql.replaceAll("\r\n", " ").replaceAll("\n", " ");

      // Split into individual statements based on -- SPLIT --
      String[] statements = preprocessedSql.split("-- SPLIT --");

      // Execute each statement
      for (String stmt : statements) {
        if (!stmt.trim().isEmpty()) {
          LOG.info("Executing Oracle statement: {}", stmt);
          statement.executeUpdate(stmt);
        }
      }
    } catch (Exception e) {
References
  1. Do not instantiate a connection pool (such as HikariDataSource) to obtain single, short-lived database connections, as it can leak the connection pool if the datasource is not closed. Use DriverManager.getConnection directly instead.

import org.junit.runners.JUnit4;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.shaded.com.google.common.collect.ImmutableMap;

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

Avoid importing shaded classes from org.testcontainers.shaded. Use the standard Guava ImmutableMap instead.

Suggested change
import org.testcontainers.shaded.com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap;

Comment on lines +58 to +59
private static HashSet<OracleSourceDbToSpannerSimpleIT> testInstances = new HashSet<>();
private static PipelineLauncher.LaunchInfo jobInfo;

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 testInstances field is unused and should be removed. Additionally, jobInfo does not need to be static since it is only used within instance test methods.

Suggested change
private static HashSet<OracleSourceDbToSpannerSimpleIT> testInstances = new HashSet<>();
private static PipelineLauncher.LaunchInfo jobInfo;
private PipelineLauncher.LaunchInfo jobInfo;

Comment on lines +61 to +62
public static OracleResourceManager oracleResourceManager;
public static SpannerResourceManager spannerResourceManager;

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

These resource managers are initialized in @Before and cleaned up in @After for each test execution. They should be instance variables (non-static) to prevent potential issues with shared state or flakiness if tests are run in parallel.

Suggested change
public static OracleResourceManager oracleResourceManager;
public static SpannerResourceManager spannerResourceManager;
public OracleResourceManager oracleResourceManager;
public SpannerResourceManager spannerResourceManager;

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 16.05839% with 115 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.70%. Comparing base (65ea26d) to head (d4bbb16).
⚠️ Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
...om/custom/CustomTransformationWithOracleForIT.java 0.00% 102 Missing ⚠️
...custom/CustomTransformationWithShardForBulkIT.java 72.41% 7 Missing and 1 partial ⚠️
.../v2/spanner/migrations/avro/AvroToValueMapper.java 25.00% 3 Missing ⚠️
...bc/rowmapper/provider/OracleJdbcValueMappings.java 0.00% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (16.05%) 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    #4161       +/-   ##
=============================================
+ Coverage     35.83%   61.70%   +25.86%     
- Complexity      711     3444     +2733     
=============================================
  Files           250      581      +331     
  Lines         17131    34959    +17828     
  Branches       1750     3878     +2128     
=============================================
+ Hits           6139    21571    +15432     
- Misses        10479    12279     +1800     
- Partials        513     1109      +596     
Components Coverage Δ
spanner-templates 84.10% <16.05%> (∅)
spanner-import-export ∅ <ø> (∅)
spanner-live-forward-migration 88.59% <25.00%> (∅)
spanner-live-reverse-replication 80.20% <16.29%> (∅)
spanner-bulk-migration 89.03% <16.66%> (∅)
gcs-spanner-dv 87.78% <25.00%> (∅)
Files with missing lines Coverage Δ
...bc/rowmapper/provider/OracleJdbcValueMappings.java 0.00% <0.00%> (ø)
.../v2/spanner/migrations/avro/AvroToValueMapper.java 93.19% <25.00%> (ø)
...custom/CustomTransformationWithShardForBulkIT.java 87.75% <72.41%> (ø)
...om/custom/CustomTransformationWithOracleForIT.java 0.00% <0.00%> (ø)

... and 424 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.

@dhwanilpatel dhwanilpatel changed the title Add oracle bulk simple IT Add oracle bulk ITs Aug 20, 2026
@dhwanilpatel
dhwanilpatel force-pushed the oracle_bulk_simple_it branch from 1ee7a1e to 0240639 Compare August 21, 2026 16:04
@dhwanilpatel
dhwanilpatel force-pushed the oracle_bulk_simple_it branch from 19f55bf to cb2dbd0 Compare August 24, 2026 05:07
@dhwanilpatel
dhwanilpatel force-pushed the oracle_bulk_simple_it branch 2 times, most recently from 648c72d to 2d38b49 Compare August 26, 2026 11:19
@dhwanilpatel
dhwanilpatel force-pushed the oracle_bulk_simple_it branch from 2d38b49 to 54b46f2 Compare August 26, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant