Tests: Run Couchbase container on Docker-assigned ports#127
Merged
amotl merged 1 commit intoJul 1, 2026
Merged
Conversation
The Couchbase test container bound host ports 1:1 (8091, 11210, ...), which clashes with any Couchbase Server already running on the workstation and could fail test_couchbase_source_local outright. The pending testcontainers-python Couchbase support binds the same ports 1:1, so it would not remove the conflict either. Switch CouchbaseContainer to Docker-assigned host ports via with_exposed_ports() and advertise those mapped ports to SDK clients through Couchbase alternate addresses (couchbase-cli setting-alternate-address for mgmt/kv/n1ql/capi). Connection strings now use the mapped KV port with network=external, so the SDK bootstraps through the alternate addresses instead of the container-internal ones. To make network=external reach the SDK, CouchbaseSource.dlt_source() now preserves non-ssl URI query parameters when building the connection string, while still consuming ssl=true internally to upgrade couchbase:// to couchbases://. Adds Docker-free unit tests for the URI query-parameter handling and updates the integration-test docstring, which no longer requires stopping a local Couchbase Server.
amotl
approved these changes
Jun 29, 2026
Member
There was a problem hiding this comment.
Wonderful, thank you for cleaning this up. Did you use the testcontainers implementation from this patch by @amithkoujalgi, or did you just strip away the static port assignments of the existing implementation?
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #127 +/- ##
==========================================
+ Coverage 50.22% 50.28% +0.06%
==========================================
Files 188 188
Lines 8948 8951 +3
==========================================
+ Hits 4494 4501 +7
+ Misses 4454 4450 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Couchbase test container binds host ports 1:1 (
8091,11210...), sotest_couchbase_source_localclashes with any Couchbase Server already running on the workstation and can fail outright. The pendingtestcontainers-pythonCouchbase support binds the same ports 1:1, so adopting it as-is would not remove the conflict.This switches the container to Docker-assigned host ports and advertises them to SDK clients via Couchbase alternate addresses, so the integration test runs alongside a local Couchbase instead of requiring you to stop it first.
Changes
CouchbaseContainernow useswith_exposed_ports(8091, 8092, 8093, 11210)instead of fixed 1:1 binds.couchbase-cli setting-alternate-addressfor the mappedmgmt/kv/n1ql/capiports.network=external, so the SDK bootstraps through the alternate addresses rather than the container-internal ones.CouchbaseSource.dlt_source()preserves non-sslURI query parameters (sonetwork=externalreaches the SDK) while still consumingssl=trueinternally to upgradecouchbase://tocouchbases://.Test plan
ruff format --checkandruff checkclean on touched filesty check omniloadcleanpytest tests/main/test_sources.py::CouchbaseSourceTest(2 passed8091:pytest tests/warehouse/db/test_couchbase.py::test_couchbase_source_local[duckdb]) 1 passedCloses #82