Repository navigation
feat(ci): expand testcontainers coverage to postgres, mysql, clickhouse, starrocks - #43652
Conversation
|
Bito Automatic Review Skipped - Branch Excluded |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/testcontainers-more-dialects #43652 +/- ##
==================================================================
Coverage 79.17% 79.17%
==================================================================
Files 2879 2879
Lines 165824 165825 +1
Branches 38331 38331
==================================================================
+ Hits 131296 131298 +2
+ Misses 32055 32054 -1
Partials 2473 2473
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6d15149 to
8514010
Compare
…se, starrocks Stacked on feat/testcontainers-more-dialects. All four extras already existed in pyproject.toml, so this only wires up tests -- no new optional-dependency groups needed. - postgres/mysql: straight copies of the timescaledb/mariadb pattern respectively, pointed at vanilla images instead of a fork/extension. - clickhouse: connects over the container's HTTP port (8123), matching clickhouse-connect (Superset's driver), not the native TCP port (9000) the container's own docstring example uses. ClickHouse has no real primary-key concept and clickhouse-connect's DDL compiler rejects CREATE TABLE without an explicit engine, so _pagination.py gained an optional extra_table_args hook to pass MergeTree(order_by=...). Also works around a pre-existing quirk in db_engine_specs/clickhouse.py: its module-level type-formatting setup dereferences current_app.config, so importing it outside a Flask app context raises RuntimeError -- tests/unit_tests/db_engine_specs/test_clickhouse.py already works around this with per-test local imports, but that suite also benefits from an autouse app_context fixture this suite doesn't have, so this test pushes one explicitly around the one-time import. - starrocks: no dedicated testcontainers module, so a generic DockerContainer against the official allin1-ubuntu image (FE+BE in one container). Not verified locally (multiple-GB image, skipped to keep local Docker load low per session guidance); the fixture retries its first connection since the query port can accept TCP before StarRocks' query engine is fully initialized.
…tarrocks readiness The FE's query port accepts connections, and can even run metadata statements like CREATE DATABASE, before the BE (execution backend) has registered with it -- an actual CREATE TABLE/INSERT then fails with "Backend node not found. Check if any backend node is down." (confirmed on real CI). Replace the bare CREATE DATABASE readiness check with a throwaway create-table-and-insert probe that exercises the exact operations the tests below need.
8514010 to
d46e798
Compare
|
The issue arises because adding the |
…ing app context `superset.db_engine_specs.clickhouse` reads `current_app.config` at import time whenever clickhouse-connect is installed, which now happens by default in the dev/CI baseline. Standalone scripts or tests that import the module without first building a Flask app crashed with RuntimeError instead of the prior silent ImportError no-op. Co-Authored-By: Claude Opus 4.8 <[email protected]>
SUMMARY
Stacks on #43640, adding 4 more dialects to the testcontainers-based
db_engine_specssuite: PostgreSQL, MySQL, ClickHouse, and StarRocks. All four already havepyproject.tomlextras, so this is purely test wiring, no new optional-dependency groups.PostgreSQL and MySQL are close to copy-paste of the TimescaleDB/MariaDB tests already in this suite, just pointed at vanilla images instead of a fork/extension. ClickHouse and StarRocks each turned up a real wrinkle:
ClickHouse has no real primary-key concept, and
clickhouse-connect's DDL compiler rejects a bareCREATE TABLEwithout an explicit engine (e.g.MergeTree(order_by=...)), so the shared_pagination.pyhelper gained an optionalextra_table_argshook. It also connects over the container's HTTP port (8123), not the native TCP port (9000) the container's own docstring example uses --clickhouse-connectis Superset's actual driver and only speaks HTTP. Along the way this surfaced a pre-existing quirk indb_engine_specs/clickhouse.py: its module-level type-formatting setup dereferencescurrent_app.config, so importing it outside a Flask app context raisesRuntimeError.tests/unit_tests/db_engine_specs/test_clickhouse.pyalready works around this with per-test local imports, but that suite also gets an app context for free from an autouse fixture this suite doesn't have, so this test pushes one explicitly around the one-time import.StarRocks has no dedicated testcontainers module, so this uses a generic
DockerContaineragainst the officialstarrocks/allin1-ubuntuimage (FE+BE in one container). Not verified locally in this environment -- it's a multi-GB image and was skipped to keep local Docker load reasonable; CI doesn't have that constraint. The fixture retries its first connection since the query port can accept TCP connections before StarRocks' query engine is fully initialized.Google Datastore was also on the original candidate list but got dropped: it looked trivial from the testcontainers side, but Superset's own
DatastoreEngineSpecdepends on an obscure, single-contributor third-party package (python-datastore-sqlalchemy) with nopyproject.tomlextra defined at all today, and it's unconfirmed whether Superset's connection path respects the emulator'sDATASTORE_EMULATOR_HOSTenv var the way the nativegoogle-cloud-datastoreclient does. Left for a follow-up once someone traces through that.TESTING INSTRUCTIONS
CI:
.github/workflows/testcontainers.ymlruns each dialect in its own matrix job (testcontainers (postgres|mysql|clickhouse|starrocks, 10-15)).Locally verified (postgres, mysql import path, clickhouse):
pytest -m testcontainers tests/testcontainers/db_engine_specs/test_postgres.py tests/testcontainers/db_engine_specs/test_clickhouse.py. MySQL couldn't be run locally (mysqlclient has a pre-existing Homebrew linking issue on this machine, same as the MariaDB test); StarRocks wasn't pulled locally per the note above -- both rely on CI for first real verification.ADDITIONAL INFORMATION