mirror of
https://github.com/apache/superset.git
synced 2026-09-05 23:12:01 +00:00
Adds five more dialects to the testcontainers suite, stacked on top of the 7-dialect pilot in feat/testcontainers-nightly-pilot: mariadb, timescaledb, yugabytedb, monetdb, mongodb. mariadb, timescaledb, and yugabytedb are all wire-compatible with an existing base dialect (MySQL and Postgres respectively), so they reuse testcontainers' MySqlContainer/PostgresContainer classes pointed at a different image rather than needing new container-class wiring. yugabytedb specifically cannot reuse PostgresContainer's built-in readiness check, though: that execs `psql`, which the yugabyte image doesn't ship (only its own `ysqlsh`) -- uses a generic DockerContainer instead, started via `yugabyted start` and waiting on its own final startup log line. monetdb has no native testcontainers module; uses a generic DockerContainer with the documented MDB_* environment variables. Publishes an amd64-only image (confirmed running under Rosetta/QEMU emulation on Apple Silicon, unlike CrateDB's harder x86-64-v3 CPU requirement). mongodb needed a different data-setup approach, like elasticsearch before it: documents get inserted via the native pymongo driver, not SQL INSERT, since MongoDB is schemaless and Superset talks to it through pymongosql (a SQL-to-MongoDB translation layer requiring a `?mode=superset` query param). Two real bugs surfaced writing this one: testcontainers' MongoDbContainer.get_connection_url() has no database path or query string at all, so naively appending "&mode=superset" glued directly onto the port number instead of starting a query string; and the root user MongoDbContainer creates lives in the `admin` database, so connecting with a different default database in the URL requires authSource=admin or authentication fails outright. Confirmed pymongosql supports OFFSET (maps to MongoDB's native `skip`), unlike Elasticsearch's SQL layer. mariadb could not be verified locally in this environment: mysqlclient (MySQLdb) has a pre-existing, unrelated native-library linking issue against this machine's Homebrew-installed libmysqlclient. CI installs it via apt on Linux, where this does not occur -- same accepted pattern already used for crate/mssql/db2 in the base branch.
118 lines
4.5 KiB
YAML
118 lines
4.5 KiB
YAML
# db_engine_specs tests against real databases (testcontainers)
|
|
name: Testcontainers
|
|
|
|
# Spins up real Docker containers (see tests/testcontainers/ for the current
|
|
# dialect list) via testcontainers-python, which catches real dialect/driver
|
|
# regressions -- the kind mocked db_engine_specs unit tests structurally
|
|
# cannot, e.g. apache/superset#42899 (Trino emitting OFFSET before LIMIT).
|
|
# Runs on a nightly cron (catches drift from a driver's own releases, not
|
|
# just from Superset's changes) and on pull_request, scoped via `paths` to
|
|
# only PRs that actually touch this test suite or the workflow itself, so
|
|
# unrelated PRs across the repo are never affected.
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 5 * * *"
|
|
workflow_dispatch: {}
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/testcontainers.yml"
|
|
- "tests/testcontainers/**"
|
|
|
|
concurrency:
|
|
# Scoped by ref, not just workflow name -- otherwise every PR run and the
|
|
# nightly cron share one group, and starting the workflow on another PR
|
|
# (or the nightly firing mid-PR-run) cancels an unrelated in-progress run.
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
testcontainers:
|
|
runs-on: ubuntu-26.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# One job per dialect rather than one job for the whole suite: a
|
|
# single slow container would otherwise inflate the wall-clock
|
|
# time for every dialect, not just its own. Running in parallel
|
|
# means the suite's total time is bounded by the slowest dialect,
|
|
# not the sum of all of them. Db2's first-boot init is documented
|
|
# upstream as notably slow (a real instance bring-up, not just a
|
|
# process start) and untested locally here (no arm64 image), so
|
|
# it gets a wider timeout margin than the rest until real CI data
|
|
# says otherwise.
|
|
- dialect: cockroachdb
|
|
timeout: 10
|
|
- dialect: crate
|
|
timeout: 10
|
|
- dialect: trino
|
|
timeout: 10
|
|
- dialect: mssql
|
|
timeout: 10
|
|
- dialect: elasticsearch
|
|
timeout: 10
|
|
- dialect: oracle
|
|
timeout: 15
|
|
- dialect: db2
|
|
timeout: 25
|
|
- dialect: mariadb
|
|
timeout: 10
|
|
- dialect: timescaledb
|
|
timeout: 10
|
|
- dialect: yugabytedb
|
|
timeout: 10
|
|
- dialect: monetdb
|
|
timeout: 10
|
|
- dialect: mongodb
|
|
timeout: 10
|
|
timeout-minutes: ${{ matrix.timeout }}
|
|
env:
|
|
PYTHONPATH: ${{ github.workspace }}
|
|
SUPERSET_TESTENV: true
|
|
SUPERSET_SECRET_KEY: not-a-secret
|
|
# This job's matrix installs exactly one dialect's testcontainers
|
|
# driver for exactly this job, so treat that driver as required: a
|
|
# broken/missing import should fail the job, not silently skip to a
|
|
# misleadingly green, zero-tests-run result. See _driver.py.
|
|
SUPERSET_TESTCONTAINERS_STRICT: true
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Setup Python
|
|
uses: ./.github/actions/setup-backend/
|
|
with:
|
|
python-version: current
|
|
- name: Install db2 driver (ibm-db-sa)
|
|
# ibm-db (the db2 DBAPI) ships no Linux arm64 wheel, so it's kept out
|
|
# of the baseline dev install (requirements/development.in) to avoid
|
|
# breaking the multi-platform dev Docker image build. Install it here
|
|
# instead, only for this leg of the matrix.
|
|
if: matrix.dialect == 'db2'
|
|
run: uv pip install --system -e .[db2]
|
|
- name: Run testcontainers db_engine_specs tests (${{ matrix.dialect }})
|
|
run: |
|
|
pytest --durations-min=2 -v -m testcontainers \
|
|
./tests/testcontainers/db_engine_specs/test_${{ matrix.dialect }}.py \
|
|
--junit-xml=test-results/junit-testcontainers-${{ matrix.dialect }}.xml
|
|
- name: Upload JUnit test results
|
|
if: always()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: junit-results-testcontainers-${{ matrix.dialect }}
|
|
path: test-results/
|
|
retention-days: 7
|
|
|
|
actions-timeline:
|
|
needs: [testcontainers]
|
|
if: always()
|
|
runs-on: ubuntu-26.04
|
|
permissions:
|
|
actions: read
|
|
steps:
|
|
- uses: Kesin11/actions-timeline@57fc93f20c6da7fbc14063c6d24a2a5627c799ad # v3.2.0
|