mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-05-24 00:53:23 -05:00
[PR #6998] [CLOSED] ci: add integration test workflow with live PostgreSQL and MySQL #12756
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/6998
Author: @TriplEight
Created: 3/22/2026
Status: ❌ Closed
Base:
main← Head:pr/3x8_integration-tests📝 Commits (1)
68fc32fci: add integration test workflow with live PostgreSQL and MySQL📊 Changes
4 files changed (+185 additions, -1 deletions)
View changed files
➕
.github/workflows/integration-test.yml(+167 -0)📝
migrations/mysql/2022-07-27-110000_add_group_support/up.sql(+1 -1)➕
migrations/mysql/2026-03-22-100000_add_primary_keys_to_group_tables/down.sql(+7 -0)➕
migrations/mysql/2026-03-22-100000_add_primary_keys_to_group_tables/up.sql(+10 -0)📄 Description
Two jobs - one per db - each spinning up a service container
diesel migration run --migration-dir migrations/ Verifies every migration applies cleanly to a fresh instance. This is the primary gap: a broken migration would otherwise only surface on production deployment.
cargo test --features with DATABASE_URL set Builds and runs the test suite against the live engine. Existing tests are unit-level (no DB access), but DATABASE_URL is wired in so any future integration tests work without further infrastructure changes.
Service containers: postgres:16, mysql:8.4 (utf8mb4).
diesel CLI binary is cached keyed on Cargo.lock hash to avoid recompiling it on every run.
Triggers on the same path set as build.yml (src/, migrations/, Cargo.*, rust-toolchain.toml).
Two bugs exposed by the integration test workflow
MySQL migration: groups_users and collections_groups used UNIQUE instead of PRIMARY KEY. Diesel requires primary keys on all tables for schema introspection (print-schema). PostgreSQL and SQLite migrations already used PRIMARY KEY correctly.
diesel.toml has [print_schema] configured, so
diesel migration runrewrites src/db/schema.rs with backend-specific types after running. This corrupted the checked-in schema before cargo test could compile, causing E0277 CompatibleType errors for every query.add MySQL migration to fix missing primary keys on group tables
groups_users and collections_groups were created with UNIQUE constraints instead of PRIMARY KEY in the 2022-07-27 migration. Add a new migration that promotes the unique indexes to primary keys.
MySQL auto-names a UNIQUE constraint after its first column, so the index names to drop are 'groups_uuid' and 'collections_uuid' respectively.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.