mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
integr test refactor
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
const stableStringify = require('json-stable-stringify');
|
const stableStringify = require('json-stable-stringify');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const fp = require('lodash/fp');
|
const fp = require('lodash/fp');
|
||||||
const { testWrapper, extractConnection } = require('../tools');
|
const { testWrapper } = require('../tools');
|
||||||
const engines = require('../engines');
|
const engines = require('../engines');
|
||||||
const { runCommandOnDriver } = require('dbgate-tools');
|
const { runCommandOnDriver } = require('dbgate-tools');
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ describe('Schema tests', () => {
|
|||||||
await runCommandOnDriver(handle, driver, dmp => dmp.createSchema('myschema'));
|
await runCommandOnDriver(handle, driver, dmp => dmp.createSchema('myschema'));
|
||||||
|
|
||||||
const schemaConnDef = {
|
const schemaConnDef = {
|
||||||
...extractConnection(engine),
|
...engine.connection,
|
||||||
database: `${handle.database}::myschema`,
|
database: `${handle.database}::myschema`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,6 @@ const mysqlEngine = {
|
|||||||
engine: 'mysql@dbgate-plugin-mysql',
|
engine: 'mysql@dbgate-plugin-mysql',
|
||||||
password: 'Pwd2020Db',
|
password: 'Pwd2020Db',
|
||||||
user: 'root',
|
user: 'root',
|
||||||
server: 'mysql',
|
|
||||||
port: 3306,
|
|
||||||
},
|
|
||||||
local: {
|
|
||||||
server: 'localhost',
|
server: 'localhost',
|
||||||
port: 15001,
|
port: 15001,
|
||||||
},
|
},
|
||||||
@@ -170,10 +166,6 @@ const mariaDbEngine = {
|
|||||||
engine: 'mariadb@dbgate-plugin-mysql',
|
engine: 'mariadb@dbgate-plugin-mysql',
|
||||||
password: 'Pwd2020Db',
|
password: 'Pwd2020Db',
|
||||||
user: 'root',
|
user: 'root',
|
||||||
server: 'mysql',
|
|
||||||
port: 3306,
|
|
||||||
},
|
|
||||||
local: {
|
|
||||||
server: 'localhost',
|
server: 'localhost',
|
||||||
port: 15004,
|
port: 15004,
|
||||||
},
|
},
|
||||||
@@ -194,10 +186,6 @@ const postgreSqlEngine = {
|
|||||||
engine: 'postgres@dbgate-plugin-postgres',
|
engine: 'postgres@dbgate-plugin-postgres',
|
||||||
password: 'Pwd2020Db',
|
password: 'Pwd2020Db',
|
||||||
user: 'postgres',
|
user: 'postgres',
|
||||||
server: 'postgres',
|
|
||||||
port: 5432,
|
|
||||||
},
|
|
||||||
local: {
|
|
||||||
server: 'localhost',
|
server: 'localhost',
|
||||||
port: 15000,
|
port: 15000,
|
||||||
},
|
},
|
||||||
@@ -370,10 +358,6 @@ const sqlServerEngine = {
|
|||||||
engine: 'mssql@dbgate-plugin-mssql',
|
engine: 'mssql@dbgate-plugin-mssql',
|
||||||
password: 'Pwd2020Db',
|
password: 'Pwd2020Db',
|
||||||
user: 'sa',
|
user: 'sa',
|
||||||
server: 'mssql',
|
|
||||||
port: 1433,
|
|
||||||
},
|
|
||||||
local: {
|
|
||||||
server: 'localhost',
|
server: 'localhost',
|
||||||
port: 15002,
|
port: 15002,
|
||||||
},
|
},
|
||||||
@@ -521,10 +505,6 @@ const cockroachDbEngine = {
|
|||||||
connection: {
|
connection: {
|
||||||
engine: 'cockroach@dbgate-plugin-postgres',
|
engine: 'cockroach@dbgate-plugin-postgres',
|
||||||
user: 'root',
|
user: 'root',
|
||||||
server: 'cockroachdb',
|
|
||||||
port: 26257,
|
|
||||||
},
|
|
||||||
local: {
|
|
||||||
server: 'localhost',
|
server: 'localhost',
|
||||||
port: 15003,
|
port: 15003,
|
||||||
},
|
},
|
||||||
@@ -535,11 +515,8 @@ const clickhouseEngine = {
|
|||||||
label: 'ClickHouse',
|
label: 'ClickHouse',
|
||||||
connection: {
|
connection: {
|
||||||
engine: 'clickhouse@dbgate-plugin-clickhouse',
|
engine: 'clickhouse@dbgate-plugin-clickhouse',
|
||||||
databaseUrl: 'http://clickhouse:8123',
|
|
||||||
password: 'Pwd2020Db',
|
|
||||||
},
|
|
||||||
local: {
|
|
||||||
databaseUrl: 'http://localhost:15005',
|
databaseUrl: 'http://localhost:15005',
|
||||||
|
password: 'Pwd2020Db',
|
||||||
},
|
},
|
||||||
objects: [views],
|
objects: [views],
|
||||||
skipDataModifications: true,
|
skipDataModifications: true,
|
||||||
@@ -562,13 +539,9 @@ const oracleEngine = {
|
|||||||
engine: 'oracle@dbgate-plugin-oracle',
|
engine: 'oracle@dbgate-plugin-oracle',
|
||||||
password: 'Pwd2020Db',
|
password: 'Pwd2020Db',
|
||||||
user: 'system',
|
user: 'system',
|
||||||
server: 'oracle',
|
|
||||||
port: 1521,
|
|
||||||
serviceName: 'xe',
|
|
||||||
},
|
|
||||||
local: {
|
|
||||||
server: 'localhost',
|
server: 'localhost',
|
||||||
port: 15006,
|
port: 15006,
|
||||||
|
serviceName: 'xe',
|
||||||
},
|
},
|
||||||
skipOnCI: false,
|
skipOnCI: false,
|
||||||
dbSnapshotBySeconds: true,
|
dbSnapshotBySeconds: true,
|
||||||
|
|||||||
@@ -9,28 +9,8 @@ function randomDbName(dialect) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractConnection(engine) {
|
|
||||||
const { connection } = engine;
|
|
||||||
|
|
||||||
return {
|
|
||||||
...connection,
|
|
||||||
...engine.local,
|
|
||||||
};
|
|
||||||
|
|
||||||
// const { connection } = engine;
|
|
||||||
|
|
||||||
// if (process.env.LOCALTEST && engine.local) {
|
|
||||||
// return {
|
|
||||||
// ...connection,
|
|
||||||
// ...engine.local,
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function connect(engine, database) {
|
async function connect(engine, database) {
|
||||||
const connection = extractConnection(engine);
|
const { connection } = engine;
|
||||||
const driver = requireEngineDriver(connection);
|
const driver = requireEngineDriver(connection);
|
||||||
|
|
||||||
if (engine.generateDbFile) {
|
if (engine.generateDbFile) {
|
||||||
@@ -55,7 +35,7 @@ async function connect(engine, database) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function prepareConnection(engine, database) {
|
async function prepareConnection(engine, database) {
|
||||||
const connection = extractConnection(engine);
|
const { connection } = engine;
|
||||||
const driver = requireEngineDriver(connection);
|
const driver = requireEngineDriver(connection);
|
||||||
|
|
||||||
if (engine.generateDbFile) {
|
if (engine.generateDbFile) {
|
||||||
@@ -104,7 +84,6 @@ const testWrapperPrepareOnly =
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
randomDbName,
|
randomDbName,
|
||||||
connect,
|
connect,
|
||||||
extractConnection,
|
|
||||||
testWrapper,
|
testWrapper,
|
||||||
testWrapperPrepareOnly,
|
testWrapperPrepareOnly,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
const requireEngineDriver = require('dbgate-api/src/utility/requireEngineDriver');
|
const requireEngineDriver = require('dbgate-api/src/utility/requireEngineDriver');
|
||||||
const engines = require('./engines');
|
const engines = require('./engines');
|
||||||
const { extractConnection } = require('./tools');
|
|
||||||
global.DBGATE_PACKAGES = {
|
global.DBGATE_PACKAGES = {
|
||||||
'dbgate-tools': require('dbgate-tools'),
|
'dbgate-tools': require('dbgate-tools'),
|
||||||
'dbgate-sqltree': require('dbgate-sqltree'),
|
'dbgate-sqltree': require('dbgate-sqltree'),
|
||||||
};
|
};
|
||||||
|
|
||||||
async function connectEngine(engine) {
|
async function connectEngine(engine) {
|
||||||
const connection = extractConnection(engine);
|
const { connection } = engine;
|
||||||
const driver = requireEngineDriver(connection);
|
const driver = requireEngineDriver(connection);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -17,11 +17,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version: 18.x
|
||||||
|
|
||||||
# - name: Install dependencies for cypress
|
|
||||||
# run: |
|
|
||||||
# apt-get update
|
|
||||||
# apt-get install -y xvfb libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6
|
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user