Skip to content

feat(ci): expand testcontainers coverage to postgres, mysql, clickhouse, starrocks - #43652

Merged
rusackas merged 3 commits into
feat/testcontainers-more-dialectsfrom
feat/testcontainers-trivial-dialects
Aug 30, 2026
Merged

rusackas merged 3 commits into
feat/testcontainers-more-dialectsfrom
feat/testcontainers-trivial-dialects

Conversation

@rusackas

Copy link
Copy Markdown
Member

SUMMARY

Stacks on #43640, adding 4 more dialects to the testcontainers-based db_engine_specs suite: PostgreSQL, MySQL, ClickHouse, and StarRocks. All four already have pyproject.toml extras, 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 bare CREATE TABLE without an explicit engine (e.g. MergeTree(order_by=...)), so the shared _pagination.py helper gained an optional extra_table_args hook. It also connects over the container's HTTP port (8123), not the native TCP port (9000) the container's own docstring example uses -- clickhouse-connect is Superset's actual driver and only speaks HTTP. Along the way this surfaced 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 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 DockerContainer against the official starrocks/allin1-ubuntu image (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 DatastoreEngineSpec depends on an obscure, single-contributor third-party package (python-datastore-sqlalchemy) with no pyproject.toml extra defined at all today, and it's unconfirmed whether Superset's connection path respects the emulator's DATASTORE_EMULATOR_HOST env var the way the native google-cloud-datastore client does. Left for a follow-up once someone traces through that.

TESTING INSTRUCTIONS

CI: .github/workflows/testcontainers.yml runs 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

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@bito-code-review

bito-code-review Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped - Branch Excluded

Bito didn't auto-review because the source or target branch is excluded from automatic reviews.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change the branch exclusion settings here, or contact your Bito workspace admin at [email protected].

@github-actions github-actions Bot added github_actions Pull requests that update GitHub Actions code dependencies:python preset-io labels Aug 28, 2026
@netlify

netlify Bot commented Aug 28, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 6d15149
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a91bdb4475a7d00089be76d
😎 Deploy Preview https://deploy-preview-43652--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.17%. Comparing base (7504457) to head (34e4f27).

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           
Flag Coverage Δ
hive 37.95% <100.00%> (+<0.01%) ⬆️
mysql 57.68% <100.00%> (+<0.01%) ⬆️
postgres 57.71% <100.00%> (+<0.01%) ⬆️
presto 39.87% <100.00%> (+<0.01%) ⬆️
python 83.75% <100.00%> (+<0.01%) ⬆️
sqlite 57.40% <100.00%> (+<0.01%) ⬆️
unit 73.97% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 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.

@rusackas
rusackas force-pushed the feat/testcontainers-trivial-dialects branch from 6d15149 to 8514010 Compare August 28, 2026 17:39
Superset Dev added 2 commits August 28, 2026 10:47
…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.
@rusackas
rusackas force-pushed the feat/testcontainers-trivial-dialects branch from 8514010 to d46e798 Compare August 28, 2026 17:47
Comment thread requirements/development.in Resolved
@bito-code-review

Copy link
Copy Markdown
Contributor

The issue arises because adding the clickhouse extra to requirements/development.in triggers the installation of clickhouse-connect. When superset.db_engine_specs.clickhouse is imported, it likely attempts to access app.config at the module level, which fails outside of a Flask application context. To resolve this, you can either move the configuration access inside a function or method that is only called when the application is active, or use a lazy-loading pattern for the configuration values. Alternatively, if the dependency is only needed for CI, you could consider moving it to a separate CI-specific requirements file, though making the module-level code app-context safe is generally the preferred approach for library stability.

…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]>
@rusackas
rusackas merged commit 9cecbf2 into feat/testcontainers-more-dialects Aug 30, 2026
79 checks passed
@rusackas
rusackas deleted the feat/testcontainers-trivial-dialects branch August 30, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants