mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 21:03:59 +00:00
test definition refactor
This commit is contained in:
@@ -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',
|
||||
testWrapper(async (conn, driver, engine) => {
|
||||
await testDatabaseDeploy(engine, conn, driver, [
|
||||
|
||||
@@ -13,8 +13,7 @@ const matviews = {
|
||||
drop2: 'DROP MATERIALIZED VIEW obj2',
|
||||
};
|
||||
|
||||
const engines = [
|
||||
{
|
||||
const mysqlEngine = {
|
||||
label: 'MySQL',
|
||||
connection: {
|
||||
engine: 'mysql@dbgate-plugin-mysql',
|
||||
@@ -27,7 +26,6 @@ const engines = [
|
||||
server: 'localhost',
|
||||
port: 15001,
|
||||
},
|
||||
// skipOnCI: true,
|
||||
objects: [
|
||||
views,
|
||||
{
|
||||
@@ -132,8 +130,9 @@ const engines = [
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
};
|
||||
|
||||
const mariaDbEngine = {
|
||||
label: 'MariaDB',
|
||||
connection: {
|
||||
engine: 'mariadb@dbgate-plugin-mysql',
|
||||
@@ -146,7 +145,6 @@ const engines = [
|
||||
server: 'localhost',
|
||||
port: 15004,
|
||||
},
|
||||
skipOnCI: true,
|
||||
objects: [views],
|
||||
dbSnapshotBySeconds: true,
|
||||
dumpFile: 'data/chinook-mysql.sql',
|
||||
@@ -156,8 +154,9 @@ const engines = [
|
||||
res: '25',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
};
|
||||
|
||||
const postgreSqlEngine = {
|
||||
label: 'PostgreSQL',
|
||||
connection: {
|
||||
engine: 'postgres@dbgate-plugin-postgres',
|
||||
@@ -218,8 +217,7 @@ const engines = [
|
||||
},
|
||||
{
|
||||
testName: 'dataTypes',
|
||||
create:
|
||||
'CREATE PROCEDURE obj1(a integer, b varchar(20), c numeric(18,2)) LANGUAGE SQL AS $$ select * from t1 $$',
|
||||
create: 'CREATE PROCEDURE obj1(a integer, b varchar(20), c numeric(18,2)) LANGUAGE SQL AS $$ select * from t1 $$',
|
||||
drop: 'DROP PROCEDURE obj1',
|
||||
objectTypeField: 'procedures',
|
||||
list: [
|
||||
@@ -268,10 +266,10 @@ create or replace function obj1(
|
||||
language plpgsql
|
||||
as $$
|
||||
begin
|
||||
select min(id),
|
||||
select min(id),
|
||||
max(id)
|
||||
into min_len, max_len
|
||||
from t1;
|
||||
into min_len, max_len
|
||||
from t1;
|
||||
end;$$`,
|
||||
drop: 'DROP FUNCTION obj1',
|
||||
list: [
|
||||
@@ -332,8 +330,9 @@ $$ LANGUAGE plpgsql;`,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
};
|
||||
|
||||
const sqlServerEngine = {
|
||||
label: 'SQL Server',
|
||||
connection: {
|
||||
engine: 'mssql@dbgate-plugin-mssql',
|
||||
@@ -453,8 +452,9 @@ END;`,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
};
|
||||
|
||||
const sqliteEngine = {
|
||||
label: 'SQLite',
|
||||
generateDbFile: true,
|
||||
connection: {
|
||||
@@ -463,8 +463,9 @@ END;`,
|
||||
objects: [views],
|
||||
skipOnCI: false,
|
||||
skipChangeColumn: true,
|
||||
},
|
||||
{
|
||||
};
|
||||
|
||||
const cockroachDbEngine = {
|
||||
label: 'CockroachDB',
|
||||
connection: {
|
||||
engine: 'cockroach@dbgate-plugin-postgres',
|
||||
@@ -476,10 +477,10 @@ END;`,
|
||||
server: 'localhost',
|
||||
port: 15003,
|
||||
},
|
||||
skipOnCI: true,
|
||||
objects: [views, matviews],
|
||||
},
|
||||
{
|
||||
};
|
||||
|
||||
const clickhouseEngine = {
|
||||
label: 'ClickHouse',
|
||||
connection: {
|
||||
engine: 'clickhouse@dbgate-plugin-clickhouse',
|
||||
@@ -489,7 +490,6 @@ END;`,
|
||||
local: {
|
||||
databaseUrl: 'http://localhost:15005',
|
||||
},
|
||||
skipOnCI: false,
|
||||
objects: [views],
|
||||
skipDataModifications: true,
|
||||
skipReferences: true,
|
||||
@@ -503,8 +503,9 @@ END;`,
|
||||
alterTableAddColumnSyntax: true,
|
||||
dbSnapshotBySeconds: true,
|
||||
skipChangeColumn: true,
|
||||
},
|
||||
{
|
||||
};
|
||||
|
||||
const oracleEngine = {
|
||||
label: 'Oracle',
|
||||
connection: {
|
||||
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 = [
|
||||
// filter local testing
|
||||
'-MySQL',
|
||||
// '-MariaDB',
|
||||
'-PostgreSQL',
|
||||
'SQL Server',
|
||||
// '-SQLite',
|
||||
// '-CockroachDB',
|
||||
// '-ClickHouse',
|
||||
// 'Oracle',
|
||||
];
|
||||
const enginesOnLocal = {
|
||||
// all engines, which would be run on local test
|
||||
mysqlEngine,
|
||||
mariaDbEngine,
|
||||
postgreSqlEngine,
|
||||
sqlServerEngine,
|
||||
sqliteEngine,
|
||||
cockroachDbEngine,
|
||||
clickhouseEngine,
|
||||
oracleEngine,
|
||||
};
|
||||
|
||||
const enginesPostgre = engines.filter(x => x.label == 'PostgreSQL');
|
||||
module.exports = process.env.CITEST ? enginesOnCi : enginesOnLocal;
|
||||
|
||||
module.exports = process.env.CITEST
|
||||
? engines.filter(x => !x.skipOnCI)
|
||||
: engines.filter(x => filterLocal.find(y => x.label == y));
|
||||
|
||||
module.exports.enginesPostgre = enginesPostgre;
|
||||
module.exports.mysqlEngine = mysqlEngine;
|
||||
module.exports.mariaDbEngine = mariaDbEngine;
|
||||
module.exports.postgreSqlEngine = postgreSqlEngine;
|
||||
module.exports.sqlServerEngine = sqlServerEngine;
|
||||
module.exports.sqliteEngine = sqliteEngine;
|
||||
module.exports.cockroachDbEngine = cockroachDbEngine;
|
||||
module.exports.clickhouseEngine = clickhouseEngine;
|
||||
module.exports.oracleEngine = oracleEngine;
|
||||
|
||||
Reference in New Issue
Block a user