mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
temp dir
This commit is contained in:
1
integration-tests/.gitignore
vendored
Normal file
1
integration-tests/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
dbtemp
|
||||||
@@ -10,25 +10,35 @@ function randomDbName() {
|
|||||||
return `db${newKey}`;
|
return `db${newKey}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function connect(connection, database) {
|
async function connect(engine, database) {
|
||||||
|
const { connection } = engine;
|
||||||
const driver = requireEngineDriver(connection);
|
const driver = requireEngineDriver(connection);
|
||||||
const conn = await driver.connect(connection);
|
|
||||||
await driver.query(conn, `CREATE DATABASE ${database}`);
|
|
||||||
await driver.close(conn);
|
|
||||||
|
|
||||||
const res = await driver.connect({
|
if (engine.generateDbFile) {
|
||||||
...connection,
|
const conn = await driver.connect({
|
||||||
database,
|
...connection,
|
||||||
});
|
databaseFile: `dbtemp/${database}`,
|
||||||
return res;
|
});
|
||||||
|
return conn;
|
||||||
|
} else {
|
||||||
|
const conn = await driver.connect(connection);
|
||||||
|
await driver.query(conn, `CREATE DATABASE ${database}`);
|
||||||
|
await driver.close(conn);
|
||||||
|
|
||||||
|
const res = await driver.connect({
|
||||||
|
...connection,
|
||||||
|
database,
|
||||||
|
});
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('Analyse tests', () => {
|
describe('Analyse tests', () => {
|
||||||
test.each(engines.map(engine => [engine.label, engine.connection]))(
|
test.each(engines.map(engine => [engine.label, engine]))(
|
||||||
'Table - full analysis (%s)',
|
'Table structure - full analysis (%s)',
|
||||||
async (label, connection) => {
|
async (label, engine) => {
|
||||||
const conn = await connect(connection, randomDbName());
|
const conn = await connect(engine, randomDbName());
|
||||||
const driver = requireEngineDriver(connection);
|
const driver = requireEngineDriver(engine.connection);
|
||||||
|
|
||||||
await driver.query(conn, 'CREATE TABLE t1 (id int)');
|
await driver.query(conn, 'CREATE TABLE t1 (id int)');
|
||||||
|
|
||||||
@@ -49,11 +59,11 @@ describe('Analyse tests', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
test.each(engines.map(engine => [engine.label, engine.connection]))(
|
test.each(engines.map(engine => [engine.label, engine]))(
|
||||||
'Table add - incremental analysis (%s)',
|
'Table add - incremental analysis (%s)',
|
||||||
async (label, connection) => {
|
async (label, engine) => {
|
||||||
const conn = await connect(connection, randomDbName());
|
const conn = await connect(engine, randomDbName());
|
||||||
const driver = requireEngineDriver(connection);
|
const driver = requireEngineDriver(engine.connection);
|
||||||
|
|
||||||
await driver.query(conn, 'CREATE TABLE t1 (id int)');
|
await driver.query(conn, 'CREATE TABLE t1 (id int)');
|
||||||
const structure1 = await driver.analyseFull(conn);
|
const structure1 = await driver.analyseFull(conn);
|
||||||
|
|||||||
0
integration-tests/dbtemp/.gitkeep
Normal file
0
integration-tests/dbtemp/.gitkeep
Normal file
@@ -29,6 +29,13 @@ const engines = [
|
|||||||
port: 15002,
|
port: 15002,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'SQLite',
|
||||||
|
generateDbFile: true,
|
||||||
|
connection: {
|
||||||
|
engine: 'sqlite@dbgate-plugin-sqlite',
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = engines;
|
module.exports = engines;
|
||||||
|
|||||||
Reference in New Issue
Block a user