Skip to content

SpannerToCassandraSourceLT fails with FileNotFoundException for session.json#3342

Open
aasthabharill wants to merge 2 commits intoGoogleCloudPlatform:mainfrom
aasthabharill:fix-SpannerToCassandraLTBase-sessionfile
Open

SpannerToCassandraSourceLT fails with FileNotFoundException for session.json#3342
aasthabharill wants to merge 2 commits intoGoogleCloudPlatform:mainfrom
aasthabharill:fix-SpannerToCassandraLTBase-sessionfile

Conversation

@aasthabharill
Copy link
Member

@aasthabharill aasthabharill commented Feb 17, 2026

https://b.corp.google.com/issues/446480838

Cause/Issue:

The SpannerToCassandraSourceLT test was failing because the test base class (SpannerToSourceDbLTBase) unconditionally mandated the presence of a session.json file. It attempted to upload this file to GCS and pass its path to the Dataflow job, causing a FileNotFoundException because the Cassandra test setup does not (and should not need to) provide a session file. The session file is an optional parameter in the spanner-to-sourcedb, but the test harness was incorrectly treating it as required.

Fix:

Modified SpannerToSourceDbLTBase to make the session.json file optional.

  1. Updated launchDataflowJob to accept an optional sessionFileName argument and only include it in the pipeline parameters if it is not null.
  2. Updated SpannerToCassandraSourceLT to pass null for the session file, effectively opting out of using it.
  3. Updated existing MySQL tests to explicitly pass their required session file paths, preserving their original behavior.

@gemini-code-assist
Copy link

Summary of Changes

Hello @aasthabharill, 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 addresses a FileNotFoundException occurring in the SpannerToCassandraSourceLT test. The issue stemmed from the test base class incorrectly mandating a session.json file, which is optional for some source types. The changes refactor the base class to make the session file optional, update the Cassandra test to reflect this, and ensure existing MySQL tests continue to provide the necessary session file.

Highlights

  • Optional Session File: The session.json file is now an optional parameter in the SpannerToSourceDbLTBase test harness, resolving FileNotFoundException issues when not required by specific tests.
  • Cassandra Test Fix: The SpannerToCassandraSourceLT test no longer fails due to the mandatory session.json requirement and has its @Ignore annotation removed, allowing it to run correctly.
  • MySQL Test Updates: Existing MySQL tests (SpannerToMySqlCustomTransformationLT and SpannerToMySqlSourceLT) have been updated to explicitly pass their required session.json file paths, maintaining their original behavior.
  • Code Refactoring: Constants for SESSION_FILE_NAME and SCHEMA_FILE_NAME were introduced in SpannerToSourceDbLTBase for improved maintainability and consistency.
Changelog
  • v2/spanner-to-sourcedb/src/test/java/com/google/cloud/teleport/v2/templates/SpannerToCassandraSourceLT.java
    • Removed @Ignore annotation and its import, enabling the test to run.
    • Updated schema file path to use the SCHEMA_FILE_NAME constant.
    • Modified launchDataflowJob call to pass null for the session file, making it optional for this test.
  • v2/spanner-to-sourcedb/src/test/java/com/google/cloud/teleport/v2/templates/SpannerToMySqlCustomTransformationLT.java
    • Updated schema file path to use the SCHEMA_FILE_NAME constant.
    • Modified launchDataflowJob call to explicitly pass SESSION_FILE_NAME.
  • v2/spanner-to-sourcedb/src/test/java/com/google/cloud/teleport/v2/templates/SpannerToMySqlSourceLT.java
    • Updated schema file path to use the SCHEMA_FILE_NAME constant.
    • Modified launchDataflowJob call to explicitly pass SESSION_FILE_NAME.
  • v2/spanner-to-sourcedb/src/test/java/com/google/cloud/teleport/v2/templates/SpannerToSourceDbLTBase.java
    • Introduced SESSION_FILE_NAME and SCHEMA_FILE_NAME constants for file paths.
    • Updated artifact upload to use the SESSION_FILE_NAME constant.
    • Modified launchDataflowJob method signature to include an optional sessionFileName parameter.
    • Updated launchDataflowJob to conditionally add sessionFilePath to parameters only if sessionFileName is provided.
Activity
  • No activity (comments, reviews, or progress updates) was provided in the context for this pull request.
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 Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.07%. Comparing base (efa629c) to head (f7fef28).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3342      +/-   ##
============================================
+ Coverage     51.03%   51.07%   +0.03%     
- Complexity     5210     5213       +3     
============================================
  Files           994      994              
  Lines         60672    60723      +51     
  Branches       6651     6657       +6     
============================================
+ Hits          30966    31014      +48     
- Misses        27528    27531       +3     
  Partials       2178     2178              
Components Coverage Δ
spanner-templates 70.90% <ø> (+0.05%) ⬆️
spanner-import-export 69.05% <ø> (+0.02%) ⬆️
spanner-live-forward-migration 79.84% <ø> (+0.02%) ⬆️
spanner-live-reverse-replication 77.42% <ø> (-0.03%) ⬇️
spanner-bulk-migration 87.99% <ø> (+0.07%) ⬆️
see 15 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.

@aasthabharill aasthabharill added bug-fix run-load-tests Run load tests in a Java PR labels Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix run-load-tests Run load tests in a Java PR size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant