mirror of
https://github.com/bitwarden/server.git
synced 2024-11-21 12:05:42 +01:00
Add MariaDB test (#4989)
* Add MariaDB Test * Use Correct Syntax * Use Container Name * Add Port * Remove MySQL Thing * Remove Another Thing * Different Port Syntax * Add Back Skipped Checks * Use Correct Connection String in Test Setup * Update .github/workflows/test-database.yml Co-authored-by: Matt Bishop <mbishop@bitwarden.com> * Update .github/workflows/test-database.yml Co-authored-by: Matt Bishop <mbishop@bitwarden.com> * Use MariaDB 10 --------- Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
This commit is contained in:
parent
639ee5780b
commit
b5014ed6d8
18
.github/workflows/test-database.yml
vendored
18
.github/workflows/test-database.yml
vendored
@ -70,6 +70,11 @@ jobs:
|
|||||||
docker compose --profile mssql --profile postgres --profile mysql up -d
|
docker compose --profile mssql --profile postgres --profile mysql up -d
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
|
- name: Add MariaDB for unified
|
||||||
|
# Use a different port than MySQL
|
||||||
|
run: |
|
||||||
|
docker run --detach --name mariadb --env MARIADB_ROOT_PASSWORD=mariadb-password -p 4306:3306 mariadb:10
|
||||||
|
|
||||||
# I've seen the SQL Server container not be ready for commands right after starting up and just needing a bit longer to be ready
|
# I've seen the SQL Server container not be ready for commands right after starting up and just needing a bit longer to be ready
|
||||||
- name: Sleep
|
- name: Sleep
|
||||||
run: sleep 15s
|
run: sleep 15s
|
||||||
@ -103,6 +108,12 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CONN_STR: "server=localhost;uid=root;pwd=SET_A_PASSWORD_HERE_123;database=vault_dev;Allow User Variables=true"
|
CONN_STR: "server=localhost;uid=root;pwd=SET_A_PASSWORD_HERE_123;database=vault_dev;Allow User Variables=true"
|
||||||
|
|
||||||
|
- name: Migrate MariaDB
|
||||||
|
working-directory: "util/MySqlMigrations"
|
||||||
|
run: 'dotnet ef database update --connection "$CONN_STR" -- --GlobalSettings:MySql:ConnectionString="$CONN_STR"'
|
||||||
|
env:
|
||||||
|
CONN_STR: "server=localhost;port=4306;uid=root;pwd=mariadb-password;database=vault_dev;Allow User Variables=true"
|
||||||
|
|
||||||
- name: Migrate Postgres
|
- name: Migrate Postgres
|
||||||
working-directory: "util/PostgresMigrations"
|
working-directory: "util/PostgresMigrations"
|
||||||
run: 'dotnet ef database update --connection "$CONN_STR" -- --GlobalSettings:PostgreSql:ConnectionString="$CONN_STR"'
|
run: 'dotnet ef database update --connection "$CONN_STR" -- --GlobalSettings:PostgreSql:ConnectionString="$CONN_STR"'
|
||||||
@ -130,6 +141,9 @@ jobs:
|
|||||||
# Default Sqlite
|
# Default Sqlite
|
||||||
BW_TEST_DATABASES__3__TYPE: "Sqlite"
|
BW_TEST_DATABASES__3__TYPE: "Sqlite"
|
||||||
BW_TEST_DATABASES__3__CONNECTIONSTRING: "Data Source=${{ runner.temp }}/test.db"
|
BW_TEST_DATABASES__3__CONNECTIONSTRING: "Data Source=${{ runner.temp }}/test.db"
|
||||||
|
# Unified MariaDB
|
||||||
|
BW_TEST_DATABASES__4__TYPE: "MySql"
|
||||||
|
BW_TEST_DATABASES__4__CONNECTIONSTRING: "server=localhost;port=4306;uid=root;pwd=mariadb-password;database=vault_dev;Allow User Variables=true"
|
||||||
run: dotnet test --logger "trx;LogFileName=infrastructure-test-results.trx"
|
run: dotnet test --logger "trx;LogFileName=infrastructure-test-results.trx"
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
@ -137,6 +151,10 @@ jobs:
|
|||||||
if: failure()
|
if: failure()
|
||||||
run: 'docker logs $(docker ps --quiet --filter "name=mysql")'
|
run: 'docker logs $(docker ps --quiet --filter "name=mysql")'
|
||||||
|
|
||||||
|
- name: Print MariaDB Logs
|
||||||
|
if: failure()
|
||||||
|
run: 'docker logs $(docker ps --quiet --filter "name=mariadb")'
|
||||||
|
|
||||||
- name: Print Postgres Logs
|
- name: Print Postgres Logs
|
||||||
if: failure()
|
if: failure()
|
||||||
run: 'docker logs $(docker ps --quiet --filter "name=postgres")'
|
run: 'docker logs $(docker ps --quiet --filter "name=postgres")'
|
||||||
|
Loading…
Reference in New Issue
Block a user