From e4796c169bdf3af9a33d5cff0343138bb0c0519c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Thu, 30 Mar 2023 15:09:13 +0200 Subject: [PATCH] ci: Run db tests with a table-prefix as well (no-changelog) (#5818) --- .github/workflows/ci-postgres-mysql.yml | 4 ++++ packages/cli/package.json | 5 +++-- packages/cli/test/integration/shared/testDb.ts | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-postgres-mysql.yml b/.github/workflows/ci-postgres-mysql.yml index 3fa601b2d..068c97740 100644 --- a/.github/workflows/ci-postgres-mysql.yml +++ b/.github/workflows/ci-postgres-mysql.yml @@ -48,6 +48,10 @@ jobs: working-directory: packages/cli run: pnpm test:postgres:alt-schema + - name: Test Postgres (table prefix) + working-directory: packages/cli + run: pnpm test:postgres:with-table-prefix + - name: Notify Slack on failure uses: act10ns/slack@v2.0.0 if: failure() diff --git a/packages/cli/package.json b/packages/cli/package.json index a171f3c3f..5cba3b5b9 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -36,9 +36,10 @@ "swagger": "swagger-cli", "test": "pnpm test:sqlite", "test:sqlite": "N8N_LOG_LEVEL=silent DB_TYPE=sqlite jest", - "test:postgres": "N8N_LOG_LEVEL=silent DB_TYPE=postgresdb jest", + "test:postgres": "N8N_LOG_LEVEL=silent DB_TYPE=postgresdb jest --no-coverage", "test:postgres:alt-schema": "DB_POSTGRESDB_SCHEMA=alt_schema pnpm test:postgres", - "test:mysql": "N8N_LOG_LEVEL=silent DB_TYPE=mysqldb jest", + "test:postgres:with-table-prefix": "DB_TABLE_PREFIX=xyz_ pnpm test:postgres", + "test:mysql": "N8N_LOG_LEVEL=silent DB_TYPE=mysqldb jest --no-coverage", "watch": "concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\"", "typeorm": "ts-node -T ../../node_modules/typeorm/cli.js" }, diff --git a/packages/cli/test/integration/shared/testDb.ts b/packages/cli/test/integration/shared/testDb.ts index c7fb165b3..ec18d2f33 100644 --- a/packages/cli/test/integration/shared/testDb.ts +++ b/packages/cli/test/integration/shared/testDb.ts @@ -512,7 +512,7 @@ export const getSqliteOptions = ({ name }: { name: string }): ConnectionOptions name, type: 'sqlite', database: ':memory:', - entityPrefix: '', + entityPrefix: config.getEnv('database.tablePrefix'), dropSchema: true, migrations: sqliteMigrations, migrationsTableName: 'migrations', @@ -525,6 +525,7 @@ const baseOptions = (type: TestDBType) => ({ port: config.getEnv(`database.${type}db.port`), username: config.getEnv(`database.${type}db.user`), password: config.getEnv(`database.${type}db.password`), + entityPrefix: config.getEnv('database.tablePrefix'), schema: type === 'postgres' ? config.getEnv('database.postgresdb.schema') : undefined, });