Skip to content

feat(#11895): Improve local DB tests with remote ClickHouse support#11973

Open
purvanshjoshi wants to merge 3 commits intocBioPortal:masterfrom
purvanshjoshi:feature/improve-local-db-tests
Open

feat(#11895): Improve local DB tests with remote ClickHouse support#11973
purvanshjoshi wants to merge 3 commits intocBioPortal:masterfrom
purvanshjoshi:feature/improve-local-db-tests

Conversation

@purvanshjoshi
Copy link

@purvanshjoshi purvanshjoshi commented Feb 19, 2026

Fix #11895

Context & Motivation

Currently, running local integration tests that involve ClickHouse can be time-consuming and resource-intensive. This is primarily because the test infrastructure spins up a fresh Docker container for every test run and performs a full data import (schema creation + data loading) via Testcontainers. This overhead significantly slows down the feedback loop for developers working on the backend.

To address this, this PR introduces the ability to run tests against a frozen, pre-populated remote ClickHouse database (e.g., hosted on ClickHouse Cloud). This bypasses the need for local Docker container initialization and data ingestion, drastically reducing test execution time and local resource usage.

Describe changes proposed in this pull request:

1. Remote ClickHouse Support in Test Infrastructure

  • Modified AbstractTestcontainers.java:
    • Introduced a new system property: db.test.use_remote_clickhouse (default: false).
    • Default Behavior (false): Preserves the existing behavior. The ClickHouseContainer is started, and tests run against the ephemeral local Docker instance. This ensures no regression for CI pipelines or developers without remote access.
    • Remote Behavior (true): When enabled, the Initializer logic skips the clickhouseContainer.start() call. Instead, it configures the Spring datasource properties (url, username, password) using values provided via system properties (e.g., db.test.clickhouse.url).

2. Documentation Updates

  • Updated docs/Testing.md: Added a dedicated section "Running tests with frozen ClickHouse Cloud database". This guides developers on how to configure their Maven commands to leverage this new feature.
  • Updated docs/development/Release-Procedure.md: Added a maintenance step to the release process. This ensures that the frozen remote database is manually updated whenever there are schema changes or updates to the test data scripts (clickhouse_cgds.sql / clickhouse_data.sql), preventing the frozen DB from drifting out of sync with the codebase.

Benefits

  • Faster Feedback Loop: Eliminates container startup and data import time for local development.
  • Resource Efficiency: Reduces local CPU/Memory overhead by offloading the database.
  • Backward Compatibility: The default configuration remains unchanged, ensuring standard mvn test runs continue to work out-of-the-box.

Checks

Any screenshots or GIFs?

N/A

Notify reviewers

@dippindots @inodb

Copilot AI review requested due to automatic review settings February 19, 2026 15:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces optional remote ClickHouse database support for test execution to improve performance by bypassing Docker container initialization. The implementation adds a configuration flag that allows developers to run tests against a pre-populated remote ClickHouse instance instead of spinning up local test containers.

Changes:

  • Modified AbstractTestcontainers.java to conditionally use remote ClickHouse when system property db.test.use_remote_clickhouse=true is set
  • Added documentation in Testing.md for running tests with remote ClickHouse instance
  • Updated Release-Procedure.md with instructions to update the frozen test database when schema or data changes occur

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/test/java/org/cbioportal/infrastructure/repository/clickhouse/AbstractTestcontainers.java Adds conditional logic to use remote ClickHouse configuration from system properties instead of starting local container
docs/Testing.md Documents how to run tests against a remote ClickHouse instance with required system properties
docs/development/Release-Procedure.md Adds step to update frozen ClickHouse test database when schema/data files change during releases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@purvanshjoshi
Copy link
Author

@dippindots @inodb Kindly review this PR at your convenience and suggest any improvements if required. I've implemented remote ClickHouse support to improve our local database tests. Your feedback would be greatly appreciated!

@purvanshjoshi purvanshjoshi force-pushed the feature/improve-local-db-tests branch from 5957755 to 2e8e7ae Compare February 24, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discussion] localdb tests improvement

2 participants