feat(#11895): Improve local DB tests with remote ClickHouse support#11973
feat(#11895): Improve local DB tests with remote ClickHouse support#11973purvanshjoshi wants to merge 3 commits intocBioPortal:masterfrom
Conversation
There was a problem hiding this comment.
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.javato conditionally use remote ClickHouse when system propertydb.test.use_remote_clickhouse=trueis set - Added documentation in
Testing.mdfor running tests with remote ClickHouse instance - Updated
Release-Procedure.mdwith 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.
src/test/java/org/cbioportal/infrastructure/repository/clickhouse/AbstractTestcontainers.java
Show resolved
Hide resolved
src/test/java/org/cbioportal/infrastructure/repository/clickhouse/AbstractTestcontainers.java
Show resolved
Hide resolved
src/test/java/org/cbioportal/infrastructure/repository/clickhouse/AbstractTestcontainers.java
Show resolved
Hide resolved
|
@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! |
5957755 to
2e8e7ae
Compare
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
db.test.use_remote_clickhouse(default:false).false): Preserves the existing behavior. TheClickHouseContaineris started, and tests run against the ephemeral local Docker instance. This ensures no regression for CI pipelines or developers without remote access.true): When enabled, the Initializer logic skips theclickhouseContainer.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
Benefits
mvn testruns continue to work out-of-the-box.Checks
Any screenshots or GIFs?
N/A
Notify reviewers
@dippindots @inodb