test definition refactor

This commit is contained in:
SPRINX0\prochazka
2024-12-20 09:03:30 +01:00
parent edf64db69a
commit 2488cee7ea
2 changed files with 531 additions and 516 deletions

View File

@@ -419,7 +419,7 @@ describe('Deploy database', () => {
}) })
); );
test.each(engines.enginesPostgre.map(engine => [engine.label, engine]))( test.each([engines.postgreSqlEngine].map(engine => [engine.label, engine]))(
'Current timestamp default value - %s', 'Current timestamp default value - %s',
testWrapper(async (conn, driver, engine) => { testWrapper(async (conn, driver, engine) => {
await testDatabaseDeploy(engine, conn, driver, [ await testDatabaseDeploy(engine, conn, driver, [

View File

@@ -13,8 +13,7 @@ const matviews = {
drop2: 'DROP MATERIALIZED VIEW obj2', drop2: 'DROP MATERIALIZED VIEW obj2',
}; };
const engines = [ const mysqlEngine = {
{
label: 'MySQL', label: 'MySQL',
connection: { connection: {
engine: 'mysql@dbgate-plugin-mysql', engine: 'mysql@dbgate-plugin-mysql',
@@ -27,7 +26,6 @@ const engines = [
server: 'localhost', server: 'localhost',
port: 15001, port: 15001,
}, },
// skipOnCI: true,
objects: [ objects: [
views, views,
{ {
@@ -132,8 +130,9 @@ const engines = [
}, },
}, },
], ],
}, };
{
const mariaDbEngine = {
label: 'MariaDB', label: 'MariaDB',
connection: { connection: {
engine: 'mariadb@dbgate-plugin-mysql', engine: 'mariadb@dbgate-plugin-mysql',
@@ -146,7 +145,6 @@ const engines = [
server: 'localhost', server: 'localhost',
port: 15004, port: 15004,
}, },
skipOnCI: true,
objects: [views], objects: [views],
dbSnapshotBySeconds: true, dbSnapshotBySeconds: true,
dumpFile: 'data/chinook-mysql.sql', dumpFile: 'data/chinook-mysql.sql',
@@ -156,8 +154,9 @@ const engines = [
res: '25', res: '25',
}, },
], ],
}, };
{
const postgreSqlEngine = {
label: 'PostgreSQL', label: 'PostgreSQL',
connection: { connection: {
engine: 'postgres@dbgate-plugin-postgres', engine: 'postgres@dbgate-plugin-postgres',
@@ -218,8 +217,7 @@ const engines = [
}, },
{ {
testName: 'dataTypes', testName: 'dataTypes',
create: create: 'CREATE PROCEDURE obj1(a integer, b varchar(20), c numeric(18,2)) LANGUAGE SQL AS $$ select * from t1 $$',
'CREATE PROCEDURE obj1(a integer, b varchar(20), c numeric(18,2)) LANGUAGE SQL AS $$ select * from t1 $$',
drop: 'DROP PROCEDURE obj1', drop: 'DROP PROCEDURE obj1',
objectTypeField: 'procedures', objectTypeField: 'procedures',
list: [ list: [
@@ -332,8 +330,9 @@ $$ LANGUAGE plpgsql;`,
}, },
}, },
], ],
}, };
{
const sqlServerEngine = {
label: 'SQL Server', label: 'SQL Server',
connection: { connection: {
engine: 'mssql@dbgate-plugin-mssql', engine: 'mssql@dbgate-plugin-mssql',
@@ -453,8 +452,9 @@ END;`,
}, },
}, },
], ],
}, };
{
const sqliteEngine = {
label: 'SQLite', label: 'SQLite',
generateDbFile: true, generateDbFile: true,
connection: { connection: {
@@ -463,8 +463,9 @@ END;`,
objects: [views], objects: [views],
skipOnCI: false, skipOnCI: false,
skipChangeColumn: true, skipChangeColumn: true,
}, };
{
const cockroachDbEngine = {
label: 'CockroachDB', label: 'CockroachDB',
connection: { connection: {
engine: 'cockroach@dbgate-plugin-postgres', engine: 'cockroach@dbgate-plugin-postgres',
@@ -476,10 +477,10 @@ END;`,
server: 'localhost', server: 'localhost',
port: 15003, port: 15003,
}, },
skipOnCI: true,
objects: [views, matviews], objects: [views, matviews],
}, };
{
const clickhouseEngine = {
label: 'ClickHouse', label: 'ClickHouse',
connection: { connection: {
engine: 'clickhouse@dbgate-plugin-clickhouse', engine: 'clickhouse@dbgate-plugin-clickhouse',
@@ -489,7 +490,6 @@ END;`,
local: { local: {
databaseUrl: 'http://localhost:15005', databaseUrl: 'http://localhost:15005',
}, },
skipOnCI: false,
objects: [views], objects: [views],
skipDataModifications: true, skipDataModifications: true,
skipReferences: true, skipReferences: true,
@@ -503,8 +503,9 @@ END;`,
alterTableAddColumnSyntax: true, alterTableAddColumnSyntax: true,
dbSnapshotBySeconds: true, dbSnapshotBySeconds: true,
skipChangeColumn: true, skipChangeColumn: true,
}, };
{
const oracleEngine = {
label: 'Oracle', label: 'Oracle',
connection: { connection: {
engine: 'oracle@dbgate-plugin-oracle', engine: 'oracle@dbgate-plugin-oracle',
@@ -565,25 +566,39 @@ END;`,
}, },
}, },
], ],
}, };
const enginesOnCi = [
// all engines, which would be run on GitHub actions
mysqlEngine,
// mariaDbEngine,
postgreSqlEngine,
sqlServerEngine,
sqliteEngine,
// cockroachDbEngine,
clickhouseEngine,
oracleEngine,
]; ];
const filterLocal = [ const enginesOnLocal = {
// filter local testing // all engines, which would be run on local test
'-MySQL', mysqlEngine,
// '-MariaDB', mariaDbEngine,
'-PostgreSQL', postgreSqlEngine,
'SQL Server', sqlServerEngine,
// '-SQLite', sqliteEngine,
// '-CockroachDB', cockroachDbEngine,
// '-ClickHouse', clickhouseEngine,
// 'Oracle', oracleEngine,
]; };
const enginesPostgre = engines.filter(x => x.label == 'PostgreSQL'); module.exports = process.env.CITEST ? enginesOnCi : enginesOnLocal;
module.exports = process.env.CITEST module.exports.mysqlEngine = mysqlEngine;
? engines.filter(x => !x.skipOnCI) module.exports.mariaDbEngine = mariaDbEngine;
: engines.filter(x => filterLocal.find(y => x.label == y)); module.exports.postgreSqlEngine = postgreSqlEngine;
module.exports.sqlServerEngine = sqlServerEngine;
module.exports.enginesPostgre = enginesPostgre; module.exports.sqliteEngine = sqliteEngine;
module.exports.cockroachDbEngine = cockroachDbEngine;
module.exports.clickhouseEngine = clickhouseEngine;
module.exports.oracleEngine = oracleEngine;