浏览代码

chore: Add mysql e2e tests to CI

Relates to #332
Michael Bromley 5 年之前
父节点
当前提交
744c2f0e61
共有 2 个文件被更改,包括 20 次插入2 次删除
  1. 10 2
      .github/workflows/build_and_test.yml
  2. 10 0
      e2e-common/test-config.ts

+ 10 - 2
.github/workflows/build_and_test.yml

@@ -47,13 +47,20 @@ jobs:
     name: e2e tests
     runs-on: ubuntu-latest
     services:
-      mysql:
+      mariadb:
         image: bitnami/mariadb:10.3
         env:
           ALLOW_EMPTY_PASSWORD: yes
         ports:
           - 3306
         options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
+      mysql:
+        image: mysql:8
+        env:
+          MYSQL_ALLOW_EMPTY_PASSWORD: yes
+        ports:
+          - 3306
+        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
       postgres:
         image: postgres:12
         env:
@@ -80,7 +87,7 @@ jobs:
         options: --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
     strategy:
       matrix:
-        db: [sqljs, mysql, postgres]
+        db: [sqljs, mariadb, mysql, postgres]
     steps:
       - uses: actions/checkout@v1
       - name: Use Node.js ${{ env.node }}
@@ -99,6 +106,7 @@ jobs:
       - name: e2e tests
         env:
           E2E_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
+          E2E_MARIADB_PORT: ${{ job.services.mariadb.ports['3306'] }}
           E2E_POSTGRES_PORT: ${{ job.services.postgres.ports['5432'] }}
           E2E_ELASTIC_PORT: ${{ job.services.elastic.ports['9200'] }}
           DB: ${{ matrix.db }}

+ 10 - 0
e2e-common/test-config.ts

@@ -23,6 +23,7 @@ const packageDir = getPackageDir();
 registerInitializer('sqljs', new SqljsInitializer(path.join(packageDir, '__data__')));
 registerInitializer('postgres', new PostgresInitializer());
 registerInitializer('mysql', new MysqlInitializer());
+registerInitializer('mariadb', new MysqlInitializer());
 
 /**
  * For local debugging of the e2e tests, we set a very long timeout value otherwise tests will
@@ -63,6 +64,15 @@ function getDbConfig(): ConnectionOptions {
                 username: 'admin',
                 password: 'secret',
             };
+        case 'mariadb':
+            return {
+                synchronize: true,
+                type: 'mariadb',
+                host: '127.0.0.1',
+                port: process.env.CI ? +(process.env.E2E_MARIADB_PORT || 3306) : 3306,
+                username: 'root',
+                password: '',
+            };
         case 'mysql':
             return {
                 synchronize: true,