integr test refactor

This commit is contained in:
SPRINX0\prochazka
2025-01-09 12:30:20 +01:00
parent dec02f2456
commit de1a1c923a
5 changed files with 7 additions and 61 deletions

View File

@@ -1,7 +1,7 @@
const stableStringify = require('json-stable-stringify');
const _ = require('lodash');
const fp = require('lodash/fp');
const { testWrapper, extractConnection } = require('../tools');
const { testWrapper } = require('../tools');
const engines = require('../engines');
const { runCommandOnDriver } = require('dbgate-tools');
@@ -62,7 +62,7 @@ describe('Schema tests', () => {
await runCommandOnDriver(handle, driver, dmp => dmp.createSchema('myschema'));
const schemaConnDef = {
...extractConnection(engine),
...engine.connection,
database: `${handle.database}::myschema`,
};

View File

@@ -19,10 +19,6 @@ const mysqlEngine = {
engine: 'mysql@dbgate-plugin-mysql',
password: 'Pwd2020Db',
user: 'root',
server: 'mysql',
port: 3306,
},
local: {
server: 'localhost',
port: 15001,
},
@@ -170,10 +166,6 @@ const mariaDbEngine = {
engine: 'mariadb@dbgate-plugin-mysql',
password: 'Pwd2020Db',
user: 'root',
server: 'mysql',
port: 3306,
},
local: {
server: 'localhost',
port: 15004,
},
@@ -194,10 +186,6 @@ const postgreSqlEngine = {
engine: 'postgres@dbgate-plugin-postgres',
password: 'Pwd2020Db',
user: 'postgres',
server: 'postgres',
port: 5432,
},
local: {
server: 'localhost',
port: 15000,
},
@@ -370,10 +358,6 @@ const sqlServerEngine = {
engine: 'mssql@dbgate-plugin-mssql',
password: 'Pwd2020Db',
user: 'sa',
server: 'mssql',
port: 1433,
},
local: {
server: 'localhost',
port: 15002,
},
@@ -521,10 +505,6 @@ const cockroachDbEngine = {
connection: {
engine: 'cockroach@dbgate-plugin-postgres',
user: 'root',
server: 'cockroachdb',
port: 26257,
},
local: {
server: 'localhost',
port: 15003,
},
@@ -535,11 +515,8 @@ const clickhouseEngine = {
label: 'ClickHouse',
connection: {
engine: 'clickhouse@dbgate-plugin-clickhouse',
databaseUrl: 'http://clickhouse:8123',
password: 'Pwd2020Db',
},
local: {
databaseUrl: 'http://localhost:15005',
password: 'Pwd2020Db',
},
objects: [views],
skipDataModifications: true,
@@ -562,13 +539,9 @@ const oracleEngine = {
engine: 'oracle@dbgate-plugin-oracle',
password: 'Pwd2020Db',
user: 'system',
server: 'oracle',
port: 1521,
serviceName: 'xe',
},
local: {
server: 'localhost',
port: 15006,
serviceName: 'xe',
},
skipOnCI: false,
dbSnapshotBySeconds: true,

View File

@@ -9,28 +9,8 @@ function randomDbName(dialect) {
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) {
const connection = extractConnection(engine);
const { connection } = engine;
const driver = requireEngineDriver(connection);
if (engine.generateDbFile) {
@@ -55,7 +35,7 @@ async function connect(engine, database) {
}
async function prepareConnection(engine, database) {
const connection = extractConnection(engine);
const { connection } = engine;
const driver = requireEngineDriver(connection);
if (engine.generateDbFile) {
@@ -104,7 +84,6 @@ const testWrapperPrepareOnly =
module.exports = {
randomDbName,
connect,
extractConnection,
testWrapper,
testWrapperPrepareOnly,
};

View File

@@ -1,13 +1,12 @@
const requireEngineDriver = require('dbgate-api/src/utility/requireEngineDriver');
const engines = require('./engines');
const { extractConnection } = require('./tools');
global.DBGATE_PACKAGES = {
'dbgate-tools': require('dbgate-tools'),
'dbgate-sqltree': require('dbgate-sqltree'),
};
async function connectEngine(engine) {
const connection = extractConnection(engine);
const { connection } = engine;
const driver = requireEngineDriver(connection);
for (;;) {
try {

View File

@@ -17,11 +17,6 @@ jobs:
with:
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
with:
fetch-depth: 1