ci: Run db tests with a table-prefix as well (no-changelog) (#5818)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-03-30 15:09:13 +02:00
committed by GitHub
parent 0b0024d722
commit e4796c169b
3 changed files with 9 additions and 3 deletions

View File

@@ -48,6 +48,10 @@ jobs:
working-directory: packages/cli working-directory: packages/cli
run: pnpm test:postgres:alt-schema 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 - name: Notify Slack on failure
uses: act10ns/slack@v2.0.0 uses: act10ns/slack@v2.0.0
if: failure() if: failure()

View File

@@ -36,9 +36,10 @@
"swagger": "swagger-cli", "swagger": "swagger-cli",
"test": "pnpm test:sqlite", "test": "pnpm test:sqlite",
"test:sqlite": "N8N_LOG_LEVEL=silent DB_TYPE=sqlite jest", "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: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\"", "watch": "concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\"",
"typeorm": "ts-node -T ../../node_modules/typeorm/cli.js" "typeorm": "ts-node -T ../../node_modules/typeorm/cli.js"
}, },

View File

@@ -512,7 +512,7 @@ export const getSqliteOptions = ({ name }: { name: string }): ConnectionOptions
name, name,
type: 'sqlite', type: 'sqlite',
database: ':memory:', database: ':memory:',
entityPrefix: '', entityPrefix: config.getEnv('database.tablePrefix'),
dropSchema: true, dropSchema: true,
migrations: sqliteMigrations, migrations: sqliteMigrations,
migrationsTableName: 'migrations', migrationsTableName: 'migrations',
@@ -525,6 +525,7 @@ const baseOptions = (type: TestDBType) => ({
port: config.getEnv(`database.${type}db.port`), port: config.getEnv(`database.${type}db.port`),
username: config.getEnv(`database.${type}db.user`), username: config.getEnv(`database.${type}db.user`),
password: config.getEnv(`database.${type}db.password`), password: config.getEnv(`database.${type}db.password`),
entityPrefix: config.getEnv('database.tablePrefix'),
schema: type === 'postgres' ? config.getEnv('database.postgresdb.schema') : undefined, schema: type === 'postgres' ? config.getEnv('database.postgresdb.schema') : undefined,
}); });