Skip to content

Testing

GitHub Actions

Automatic CI on pushes to main/master and pull requests selects gates from the changed files. Repository safety and Git-history secret scanning always run. The stable CI checks job fails if any selected job fails or is cancelled; use it as the required branch-protection check instead of individual conditional jobs. Superseded runs on the same PR/branch are cancelled automatically. Selected workflow changes run actionlint for YAML structure, expressions, action inputs and embedded scripts.

Change Selected checks
Markdown/documentation Strict MkDocs build; no application images or fixtures
Web unit tests Web format, lint, types and unit tests
API unit tests API lint, types and tests with real PostgreSQL worker concurrency
Menu, login or CSS Web quality, runtime smoke and core-only Playwright login/navigation checks; no CDC databases or MinIO
Web public assets Web quality plus native runtime/asset smoke
Other web application code Runtime smoke and full browser flows with fixtures, without repeating JDBC/S3 content acceptance
Shared API/runtime or integration code Relevant quality checks and runtime smoke; CDC, S3 and full browser acceptance on AMD64
Object-storage implementation/fixture only Real S3 content acceptance; no JDBC/browser acceptance or destination databases
Connector, Docker/Compose or native dependency code Native AMD64 and ARM64 image builds/core smoke
Compose/Docker configuration One Compose rendering check on Ubuntu, including all CI overrides
Kubernetes configuration Deployment contract and strict Kubernetes schemas
Dependency manifests/lockfiles Corresponding npm or Python dependency audit
Workload generator Native image/dependency checks on both architectures; source database regression tests on AMD64, without MinIO/browser/CDC acceptance
Release/repository tooling API lint, types and unit/contract tests; no runtime data fixtures
Deployment validation/cluster harness API unit/contract tests and deployment/schema validation; live cluster acceptance stays in hardening
Documentation workflow Workflow lint and strict documentation build
Release workflows Workflow lint and API contract tests; deployment validation for shared quality/hardening workflows

ARM64 uses a native ubuntu-24.04-arm runner, not QEMU. Ordinary application/UI changes run the container job on AMD64 on both pull requests and branch pushes. Changes to Docker/Compose/environment inputs, fixtures/connectors, dependency manifests/lockfiles, native source files or the workload generator also select ARM64. Full manual CI and uncertain change comparisons keep both architectures. This avoids rebuilding architecture-neutral code a second time after merge; native packaging changes still get native build/smoke checks before merge. Documentation/unit-test-only changes skip runtime containers on both architectures.

Weekly scheduled runs repeat both dependency audits even without source changes, so new advisories are still checked. They do not start runtime/test stacks and use a separate concurrency group so they cannot cancel a push/PR validation.

Changes to the main CI workflow, shared actions, selector or CI Compose overrides select every gate. Known documentation/release/source workflows select their own lint and contract checks, without starting unrelated CDC/S3/browser stacks. Unknown workflows/build configuration and an unavailable comparison base still select every gate. Deleted and renamed files are included. Mixed changes take the union of required checks; scoped tooling never masks an application change. scripts/ci_changes.py has regression tests for these selections.

Manual CI with run_full_ci=true selects every gate; with it disabled, only documentation and repository safety checks run. Release validation still runs all quality/dependency gates regardless of changed paths, followed by the full hardening and Kubernetes acceptance gates.

API and web images are built once with Bake and per-image/per-architecture GitHub Actions build caches. Their cache exports have a 60-second timeout; an export failure cannot bypass image build or smoke failures. API, worker and MinIO bootstrap share one API image through .github/compose.ci.yaml and .github/compose.test.ci.yaml. Core startup uses --no-build; relevant AMD64 runs add test fixtures to the existing stack without an intermediate down. The CI test override puts MinIO/bootstrap behind the object-storage profile; S3-only runs start the PostgreSQL source, not destination databases. The API's bucket-bootstrap dependency is optional while that profile is disabled and waits for successful completion when enabled. Both paths are compatible with Compose 2.24.7. This changes CI overrides only, not the normal Compose quick start.

Connect and MinIO use .github/actions/cached-ci-image: cache the loadable final image archive, not all Java/Go builder layers. A cache miss builds normally with --pull for MinIO; a Connect miss joins the parallel API/web Bake build. The finished image is saved by the cache action's job cleanup hook; a hit loads it directly. Exact keys include runner OS/CPU, Dockerfile/source/build-context inputs and resolved upstream base image digests. There are no stale prefix restores. Loaded/built image architecture must match the native runner. MinIO is prepared only for S3 content or full browser acceptance, after core smoke; it never blocks core startup.

The selector emits independent cdc, s3, browser and browser_integration gates. Core browser checks do not become full integration just because an unrelated workload file also changes. Shared backend/build inputs remain conservative and select full acceptance. The optional host Python tooling installs only the pinned boto3/confluent-kafka requirements read from the API manifest; it does not install the API development toolchain again. Browser installation skips the unused headless-shell download because the tests use Chromium channel. ARM64 does not install host npm/pip application tooling or repeat MinIO, CDC, S3 or Playwright acceptance. Its core HTTP/asset, native image optimization and migration smoke checks remain enabled whenever selected. The optional commerce image is built only for workload changes or an explicit full run. Failure diagnostics are redacted and uploaded only when needed; full release hardening retains its success reports. Browser/demo seed scripts remain necessary fixtures and are not obsolete.

The separate Documentation workflow continues to build and deploy GitHub Pages on documentation changes pushed to main, or when manually triggered. Its strict build produces the actual Pages artifact; the CI documentation job validates pull requests before publication. Neither job deploys from a PR.

The separate Hardening acceptance workflow is manually dispatched for expensive fault injection and is also called by the Release workflow. Both container publication and GitHub Release creation depend on it; a failed live gate cannot be bypassed by a successful unit/build job. The workflow also runs a separate isolated kind/Calico/NGINX job for real production rollout, HTTPS session boundaries and NetworkPolicy allow/deny/revocation. Preparation never dispatches a workflow, pushes a tag, or publishes an image automatically.

CI check review

Checks are retained when they catch a distinct failure in behavior, data, security or packaging. A second execution is useful only when its environment or assertions cover something different.

Check Decision and reason
API/web unit tests, validation, RBAC and session invalidation Keep: fast feedback for application behavior and security boundaries
PostgreSQL worker lease/concurrency tests Keep: SQLite does not exercise PostgreSQL transaction/race behavior
CDC/JDBC/S3 content acceptance and browser integration Keep for relevant changes: mocks and unit tests cannot verify connector delivery, stored data or browser/API wiring
Recovery, TLS/SASL, metadata backup/upgrade and Kubernetes fault/policy acceptance Keep in manual/release hardening: these verify operational guarantees; they do not belong on every small PR
Native AMD64/ARM64 smoke Keep both for packaging/native dependencies and full runs; omit the second CPU for architecture-neutral application-only changes
Compose render on three operating systems Reduce to Ubuntu: this checks the same daemon-free configuration/schema, not Windows/macOS container behavior
Existing-source pytest subset in every experimental source matrix entry Remove: the same tests already run in the API job and full release validation; the matrix retains distinct MariaDB/SQL Server/MongoDB live checks and installs runtime dependencies only
Page export typeof ... === "function" unit test Remove: it mocked every page implementation and checked no rendering, navigation or permissions; production build and browser tests cover the actual routes
Assertions on exact cache wiring/timeouts Remove: these constrained workflow implementation without verifying application behavior; retain CPU/base-digest cache isolation tests
Handwritten Python-only workflow compilation test Replace with actionlint: validate the workflow and its expressions/scripts with the maintained workflow validator
Dependency audits and repository/secret checks Keep: unit tests cannot detect newly disclosed advisories or committed secrets; weekly audits cover unchanged dependencies
Full release quality/hardening Keep regardless of PR selection: validate the exact release candidate/tag rather than assuming a previous run tested it

Build/cache timing must be measured in GitHub Actions with both a cold and a warm cache. Removing duplicate work does not establish a new measured duration.

Fast checks

npm ci
python -m pip install -e "apps/api[dev]"
npm run format:check
npm run lint
npm run typecheck
npm run test:web
npm run lint:api
npm run typecheck:api
npm run test:api
npm run build
python scripts/check-repository.py

API unit tests use temporary SQLite and mocked external clients where isolation is intentional. Web unit tests use Vitest and Testing Library.

WORKER_TEST_DATABASE_URL enables a real PostgreSQL concurrency test: two workers race for one job and only one claim succeeds. Each test creates and removes its own UUID-named schema. Every selected API job provides a dedicated PostgreSQL service. Lease recovery, classified transient/permanent failures, capped exponential backoff with jitter, terminal failure, manual retry with retained history, result persistence and cancellation also have unit coverage. Collection tests assert SQL query counts stay constant as the number of resources grows. Concurrency coverage verifies deterministic deploy adoption, exact-config collision rejection, connector lifecycle operation leases, stale-owner recovery, duplicate table-operation suppression, and reuse of a pending automatic job by manual retry. The PostgreSQL acceptance check races two independent metadata sessions and requires exactly one lifecycle lease winner. The v0.2.0 upgrade acceptance test restores populated metadata, downgrades only the isolated fixture to released revision 0003, adds non-empty session/invite fixtures, takes a verified pre-upgrade backup, and runs metadata_upgrade.py to head twice. Counts, identity hashes, ciphertext hashes, secret decryption, drift checking, and idempotency must all pass before the fixture database is removed.

Live integration

Start the integration stack with docker compose -f compose.yaml -f compose.test.yaml up -d --build --wait, run scripts/cdc-integrity.py, scripts/demo-object-storage.py, and then Playwright. The older focused demo scripts remain useful for manual UI smoke testing. These checks use the real source, Debezium, Kafka, Connect, destination, API proxy, and browser path. Test artifacts are ignored and must be sanitized before sharing.

For an isolated stack that does not depend on a repository .env file:

docker compose --env-file .env.example --env-file .env.test.example \
  -p cluecdc-acceptance -f compose.yaml -f compose.test.yaml \
  up -d --build --wait --wait-timeout 300
python scripts/cdc-integrity.py \
  --api-url http://localhost:3000/api/v1 \
  --compose-project cluecdc-acceptance \
  --env-file .env.example --env-file .env.test.example
python scripts/cdc-recovery.py \
  --api-url http://localhost:3000/api/v1 \
  --compose-project cluecdc-acceptance \
  --env-file .env.example --env-file .env.test.example
python scripts/cdc-schema-safety.py \
  --api-url http://localhost:3000/api/v1 \
  --compose-project cluecdc-acceptance \
  --env-file .env.example --env-file .env.test.example
python scripts/cdc-retention-safety.py \
  --api-url http://localhost:3000/api/v1 \
  --compose-project cluecdc-acceptance \
  --env-file .env.example --env-file .env.test.example
python scripts/cdc-failure-recovery.py \
  --api-url http://localhost:3000/api/v1 \
  --compose-project cluecdc-acceptance \
  --env-file .env.example --env-file .env.test.example
python scripts/demo-object-storage.py \
  --api-url http://localhost:3000/api/v1 \
  --compose-project cluecdc-acceptance \
  --env-file .env.example --env-file .env.test.example
docker compose --env-file .env.example --env-file .env.test.example \
  -p cluecdc-acceptance -f compose.yaml -f compose.test.yaml down

The integrity matrix creates run-scoped tables and tests PostgreSQL and MySQL sources against both JDBC destinations. It reconciles the initial snapshot and streamed materialized state by primary key after transactions, inserts, sequential updates, deletes and a primary-key update. Values include NULL, UTF-8, high-precision decimals and timestamps. Decimal scale and equivalent UTC offsets are normalized during comparison, and mismatch errors report bounded keys/field names without dumping row contents.

JDBC delivery is at least once. The default upsert plus stable record keys makes replay idempotent at the materialized-row level, but ClueCDC does not claim distributed exactly-once delivery. Insert mode is not replay-idempotent. MySQL DATETIME has no stored zone; ClueCDC treats the integration fixture as UTC. PostgreSQL timestamptz values are compared as UTC instants. Destination constraints, engine-specific types, triggers and generated values can still produce semantics that require application-specific reconciliation.

The schema-safety acceptance test verifies initial and incremental snapshots, add/remove table isolation, restart during a 5,000-row snapshot, cancellation and concurrent-operation rejection. It also validates additive nullable and defaulted columns, widening/breaking schema classifications, explicit resnapshot backfill, and actionable rejection of unsupported destination types.

The retention-safety acceptance test verifies PostgreSQL logical-slot inventory, retained-WAL measurement and non-mutating inactive-slot warnings. It also checks MySQL's exact configured expiration, current position/file inventory, comparison with the configured outage objective, and the critical alert recovery lifecycle.

The failure-recovery test requires the integrity and recovery artifacts from the preceding commands. It injects Connect REST, API/worker, source database, and destination database failures. The test asserts that manual pause intent survives unavailable observed state and restarts, dependency failures are visible, delivery catches up after recovery, and no connector is recreated or silently reconfigured. A rerun safely resumes its run-scoped fixture if an earlier interrupted test left it paused.

The object-storage check mutates the real PostgreSQL source, waits for Debezium and the Aiven sink, decompresses generated MinIO objects and checks c/u/d event content, record keys, before/after values, timestamps and source metadata. It needs no AWS account. Its sanitized report is artifacts/object-storage-verification.json.

Object storage is checked as an append-only CDC event log, not as a materialized table. The test validates keyed create/update/delete envelopes and before/after content. At-least-once retries may create duplicate events, so downstream consumers must deduplicate by topic, partition and offset.

Documentation is validated with mkdocs build --strict.

Combined hardening gate (TEST-01)

python scripts/hardening_acceptance.py

The runner creates its own UUID-scoped Compose project and selects unused loopback ports. It refuses existing project resources, waits for health with explicit deadlines, runs integrity → connector recovery → schema/snapshot → retention → failure injection → object storage → secret boundaries → populated backup/restore/upgrade → production runtime → authenticated Kafka acceptance, and removes only resources and volumes owned by that invocation. Existing Compose projects and their volumes are preserved. Do not direct individual failure-injection scripts at shared or external infrastructure.

artifacts/hardening-gate.json records the candidate SHA, timestamps, stage results, durations and cleanup outcome. It updates at stage boundaries, including timeout failures, so an interrupted run cannot leave a previous PASS report. Docker/daemon unavailability produces INFRASTRUCTURE_UNAVAILABLE and exit code 2; executed assertion, build, startup or data mismatch failures produce FAIL and exit code 1. Neither is success. Bounded sanitized service logs aid diagnosis; raw metadata archives and temporary TLS private keys are excluded from CI artifact upload.

The CI invocation also supplies --env-file .env --browser after creating a disposable .env from the examples and bootstrapping secrets. This runs the existing demo fixtures and Playwright suite inside the owned project. It does not overwrite a developer's .env; use a disposable checkout for that workflow.

CI first builds five local images with Bake and independent GitHub Actions cache scopes (API/worker share one image). It then passes --prebuilt-image-prefix cluecdc-hardening-ci, requiring locally loaded PREFIX-{api,web,connect,minio,bootstrap}:ci images and starting with --no-build. Build these from the candidate checkout; the ordinary local command still builds from source. Missing images fail before stack creation. Cache misses trigger a normal build; optional cache-export failures do not bypass any acceptance gate. No image is pushed by this preparation job. The pinned MinIO source build is cached rather than replaced with an unverified binary.

Security fixtures stage private files over stdin into an owned Docker volume with explicit read-group access; Linux host 0700 temporary directories are not bind-mounted into a different container UID. Broker/Connect containers stay non-root with read-only fixture mounts. A stopped process fails readiness immediately, reporting exit/OOM state. Inspect kafka-security.json for phase, duration and cleanup, and the sanitized kafka-security-diagnostics.log on failure; both are included in the CI artifact. Private keys/config files and database archives remain excluded. Diagnostic timeouts do not skip cleanup.

Requirement/category Primary verification Execution
Unit, API security, RBAC API pytest and web Vitest PR CI and release validation
SEC-03 TLS/SASL, authenticated source/sink kafka_security_acceptance.py Live hardening/release gate
SEC-04 secret boundaries verify-secrets.py Smoke and live hardening gate
CDC-01 integrity/object storage cdc-integrity.py, demo-object-storage.py Live hardening gate
CDC-02 connector restart/offset recovery cdc-recovery.py Live hardening gate
CDC-03 schema/snapshot safety cdc-schema-safety.py Live hardening gate
CDC-04 retention diagnostics cdc-retention-safety.py Live hardening gate
REL-01 failure injection cdc-failure-recovery.py Live hardening gate
REL-02/03 retry, job/operation ownership pytest, PostgreSQL lease races PR CI and release validation
OPS-01/02 migration/backup/restore metadata_acceptance.py, Alembic checks Live hardening gate
OPS-03 manifests and container lifecycle deployment_validation.py, kubeconform, deployment_runtime.py, kubernetes_acceptance.py PR/release and live/Kubernetes gates
Browser integration existing Playwright suite Smoke CI and release hardening gate

metadata_acceptance.py copies populated live fixture metadata into a new database, downgrades only that copy to v0.2.0 revision 0003, ensures sessions and invites are nonempty, takes a verified backup, runs the guarded upgrade twice, restores into another empty database, verifies decryption, and rejects wrong keys/nonempty restore targets. Only exact databases created by the run are removed. The original database is never downgraded or reset.

Kubernetes validation renders the exact base or --kustomize-dir overlay, checks resource/probe/security/Secret/network boundaries, and validates all resources against Kubernetes schemas. The runtime harness additionally checks production settings and read-only containers with random secrets and a separate PostgreSQL instance. Cluster rollout, ingress TLS and CNI policy enforcement still require target-cluster evidence before a pilot is approved. The separate Kubernetes acceptance job supplies repeatable local kind/Calico/NGINX evidence for those behaviors, including a trusted TLS login, Secure cookies and origin rejection. Its short-lived certificate fixture also passes a strict verified TLS handshake unit test; no trust/hostname verification is disabled.