Skip to content

fix java neo4j tests - #4503

Merged
derrickaw merged 1 commit into
GoogleCloudPlatform:mainfrom
derrickaw:20261028_neoJavaIssue
Oct 29, 2026
Merged

derrickaw merged 1 commit into
GoogleCloudPlatform:mainfrom
derrickaw:20261028_neoJavaIssue

Conversation

@derrickaw

@derrickaw derrickaw commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

see issue here https://github.com/GoogleCloudPlatform/DataflowTemplates/actions/runs/40684579964

Problem: In ConstraintsIndicesIT, Neo4j5CommunityIT and Neo4j44CommunityIT shared a single class-level Neo4jResourceManager instance (@BeforeClass) across test methods that run in parallel (parallel='classesAndMethods'). Unlike Neo4j Enterprise Edition, Neo4j Community Edition only supports a single "neo4j" database, so canResetDatabase() created an index (CREATE INDEX FOR (n:From) ON n.name) in the shared "neo4j" database while doesNotCreateExtraIndicesWhenImportingRelationships() and doesNotCreateExtraIndicesWhenImportingNodes() concurrently asserted that no non-lookup indexes existed (count = 0), causing flaky test failures whenever their Dataflow jobs finished before canResetDatabase() reset the database.

Fix: Scope Neo4jResourceManager in Neo4j5CommunityIT and Neo4j44CommunityIT to the test method level (@before / @after) so each parallel test method runs against its own isolated Neo4j Community container, while keeping class-level containers for the Enterprise Edition test classes that isolate tests via per-test databases.
Also, update naming of one class.

@derrickaw

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 refactors the integration tests in ConstraintsIndicesIT.java. Specifically, it updates the Neo4j5CommunityIT and Neo4j44CommunityIT nested classes to use instance-level @before and @after lifecycle annotations instead of class-level @BeforeClass and @afterclass annotations, ensuring the neo4jClient is initialized and cleaned up per test. It also fixes a copy-paste bug in Neo4j44EnterpriseIT where the wrong class name was passed to setupClient. There are no review comments, so I have no feedback to provide.

@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.85%. Comparing base (a2d54f2) to head (b020210).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4503      +/-   ##
============================================
- Coverage     56.87%   56.85%   -0.02%     
+ Complexity     8088     7626     -462     
============================================
  Files          1164     1164              
  Lines         74114    74114              
  Branches       8735     8735              
============================================
- Hits          42150    42136      -14     
- Misses        29164    29176      +12     
- Partials       2800     2802       +2     
Components Coverage Δ
spanner-templates 83.70% <ø> (+<0.01%) ⬆️
spanner-import-export 72.21% <ø> (-0.14%) ⬇️
spanner-live-forward-migration 86.93% <ø> (+0.01%) ⬆️
spanner-live-reverse-replication 79.21% <ø> (+0.01%) ⬆️
spanner-bulk-migration 87.88% <ø> (+<0.01%) ⬆️
gcs-spanner-dv 85.71% <ø> (+0.01%) ⬆️
see 5 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.

@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 addresses flaky integration tests in the Neo4j template suite caused by shared resource contention in Neo4j Community Edition. By moving from class-level to method-level resource management, each test now runs in an isolated container, preventing race conditions where concurrent tests modify the same shared database instance. Additionally, a minor configuration fix was applied to the Enterprise Edition test setup.

Highlights

  • Test Isolation: Refactored Neo4j5CommunityIT and Neo4j44CommunityIT to use method-level (@Before/@after) resource management instead of class-level (@BeforeClass/@afterclass).
  • Concurrency Fix: Isolated Neo4j Community Edition containers per test method to prevent cross-test interference in parallel execution environments.
  • Bug Fix: Corrected a configuration error in Neo4j44EnterpriseIT where the wrong class name was passed to the setupClient method.
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 refactors the integration tests in ConstraintsIndicesIT.java by converting static class-level setup and cleanup methods (@BeforeClass/@afterclass) to instance-level methods (@Before/@after) for community editions, and fixing a class name typo in Neo4j44EnterpriseIT. The feedback suggests prefixing the test identifier with the class's simple name in Neo4j5CommunityIT and Neo4j44CommunityIT to avoid resource naming collisions during parallel test execution.

@derrickaw
derrickaw requested a review from Abacn October 29, 2026 16:58

@Abacn Abacn 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.

Thanks

@derrickaw
derrickaw merged commit f4ba1e9 into GoogleCloudPlatform:main Oct 29, 2026
26 of 29 checks passed
@derrickaw
derrickaw deleted the 20261028_neoJavaIssue branch October 29, 2026 19:31
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