From b5014ed6d89eef05540ca74855f0e07b23abefb4 Mon Sep 17 00:00:00 2001 From: Justin Baur <19896123+justindbaur@users.noreply.github.com> Date: Wed, 6 Nov 2024 16:51:10 -0500 Subject: [PATCH] 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 * Update .github/workflows/test-database.yml Co-authored-by: Matt Bishop * Use MariaDB 10 --------- Co-authored-by: Matt Bishop --- .github/workflows/test-database.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/test-database.yml b/.github/workflows/test-database.yml index f053e81a5..134e96b33 100644 --- a/.github/workflows/test-database.yml +++ b/.github/workflows/test-database.yml @@ -70,6 +70,11 @@ jobs: docker compose --profile mssql --profile postgres --profile mysql up -d 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 - name: Sleep run: sleep 15s @@ -102,6 +107,12 @@ jobs: run: 'dotnet ef database update --connection "$CONN_STR" -- --GlobalSettings:MySql:ConnectionString="$CONN_STR"' env: 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 working-directory: "util/PostgresMigrations" @@ -130,6 +141,9 @@ jobs: # Default Sqlite BW_TEST_DATABASES__3__TYPE: "Sqlite" 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" shell: pwsh @@ -137,6 +151,10 @@ jobs: if: failure() 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 if: failure() run: 'docker logs $(docker ps --quiet --filter "name=postgres")'