mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 21:05:59 +00:00
Merge branch 'feature/test-refactor'
This commit is contained in:
48
.github/workflows/run-tests.yaml
vendored
48
.github/workflows/run-tests.yaml
vendored
@@ -11,12 +11,11 @@ name: Run tests
|
|||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: 'node:18'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install dependencies for cypress
|
- name: Use Node.js 18.x
|
||||||
run: |
|
uses: actions/setup-node@v1
|
||||||
apt-get update
|
with:
|
||||||
apt-get install -y xvfb libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6
|
node-version: 18.x
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
@@ -67,32 +66,61 @@ jobs:
|
|||||||
result-file: packages/datalib/result.json
|
result-file: packages/datalib/result.json
|
||||||
action-name: Datalib (perspectives) test results
|
action-name: Datalib (perspectives) test results
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres-integr:
|
||||||
image: postgres
|
image: postgres
|
||||||
env:
|
env:
|
||||||
POSTGRES_PASSWORD: Pwd2020Db
|
POSTGRES_PASSWORD: Pwd2020Db
|
||||||
options: '--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5'
|
options: '--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5'
|
||||||
mysql:
|
ports:
|
||||||
|
- '15000:5432'
|
||||||
|
mysql-integr:
|
||||||
image: 'mysql:8.0.18'
|
image: 'mysql:8.0.18'
|
||||||
env:
|
env:
|
||||||
MYSQL_ROOT_PASSWORD: Pwd2020Db
|
MYSQL_ROOT_PASSWORD: Pwd2020Db
|
||||||
mssql:
|
ports:
|
||||||
|
- '15001:3306'
|
||||||
|
mssql-integr:
|
||||||
image: mcr.microsoft.com/mssql/server
|
image: mcr.microsoft.com/mssql/server
|
||||||
env:
|
env:
|
||||||
ACCEPT_EULA: 'Y'
|
ACCEPT_EULA: 'Y'
|
||||||
SA_PASSWORD: Pwd2020Db
|
SA_PASSWORD: Pwd2020Db
|
||||||
MSSQL_PID: Express
|
MSSQL_PID: Express
|
||||||
clickhouse:
|
ports:
|
||||||
|
- '15002:1433'
|
||||||
|
clickhouse-integr:
|
||||||
image: 'bitnami/clickhouse:24.8.4'
|
image: 'bitnami/clickhouse:24.8.4'
|
||||||
env:
|
env:
|
||||||
CLICKHOUSE_ADMIN_PASSWORD: Pwd2020Db
|
CLICKHOUSE_ADMIN_PASSWORD: Pwd2020Db
|
||||||
oracle:
|
ports:
|
||||||
|
- '15005:8123'
|
||||||
|
oracle-integr:
|
||||||
image: 'gvenzl/oracle-xe:21-slim'
|
image: 'gvenzl/oracle-xe:21-slim'
|
||||||
env:
|
env:
|
||||||
ORACLE_PASSWORD: Pwd2020Db
|
ORACLE_PASSWORD: Pwd2020Db
|
||||||
|
ports:
|
||||||
|
- '15006:1521'
|
||||||
|
postgres-cypress:
|
||||||
|
image: postgres
|
||||||
|
options: '--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5'
|
||||||
|
env:
|
||||||
|
POSTGRES_PASSWORD: Pwd2020Db
|
||||||
|
ports:
|
||||||
|
- '16000:5432'
|
||||||
|
mysql-cypress:
|
||||||
|
image: 'mysql:8.0.18'
|
||||||
|
ports:
|
||||||
|
- '16004:3306'
|
||||||
|
env:
|
||||||
|
MYSQL_ROOT_PASSWORD: Pwd2020Db
|
||||||
mysql-ssh-login:
|
mysql-ssh-login:
|
||||||
image: 'ghcr.io/dbgate/mysql-ssh-login:latest'
|
image: 'ghcr.io/dbgate/mysql-ssh-login:latest'
|
||||||
|
ports:
|
||||||
|
- '16006:22'
|
||||||
mysql-ssh-keyfile:
|
mysql-ssh-keyfile:
|
||||||
image: 'ghcr.io/dbgate/mysql-ssh-keyfile:latest'
|
image: 'ghcr.io/dbgate/mysql-ssh-keyfile:latest'
|
||||||
|
ports:
|
||||||
|
- '16008:22'
|
||||||
dex:
|
dex:
|
||||||
image: 'ghcr.io/dbgate/dex:latest'
|
image: 'ghcr.io/dbgate/dex:latest'
|
||||||
|
ports:
|
||||||
|
- '16009:5556'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
issuer: http://dex:5556/dex
|
issuer: http://localhost:16009/dex
|
||||||
storage:
|
storage:
|
||||||
type: memory
|
type: memory
|
||||||
web:
|
web:
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ module.exports = defineConfig({
|
|||||||
serverProcess = exec('yarn start:add-connection');
|
serverProcess = exec('yarn start:add-connection');
|
||||||
break;
|
break;
|
||||||
case 'portal':
|
case 'portal':
|
||||||
serverProcess = exec('yarn start:portal:local');
|
serverProcess = exec('yarn start:portal');
|
||||||
break;
|
break;
|
||||||
case 'oauth':
|
case 'oauth':
|
||||||
serverProcess = exec('yarn start:oauth:local');
|
serverProcess = exec('yarn start:oauth');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,12 @@ describe('Add connection', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('adds connection', () => {
|
it('adds connection', () => {
|
||||||
const runOnCI = Cypress.env('runOnCI');
|
|
||||||
|
|
||||||
cy.visit('http://localhost:3000');
|
cy.visit('http://localhost:3000');
|
||||||
// cy.get('[data-testid=ConnectionList_buttonNewConnection]').click();
|
// cy.get('[data-testid=ConnectionList_buttonNewConnection]').click();
|
||||||
cy.get('[data-testid=ConnectionDriverFields_connectionType]').select('MySQL');
|
cy.get('[data-testid=ConnectionDriverFields_connectionType]').select('MySQL');
|
||||||
cy.get('[data-testid=ConnectionDriverFields_user]').clear().type('root');
|
cy.get('[data-testid=ConnectionDriverFields_user]').clear().type('root');
|
||||||
cy.get('[data-testid=ConnectionDriverFields_password]').clear().type('Pwd2020Db');
|
cy.get('[data-testid=ConnectionDriverFields_password]').clear().type('Pwd2020Db');
|
||||||
if (runOnCI) {
|
cy.get('[data-testid=ConnectionDriverFields_port]').clear().type('16004');
|
||||||
cy.get('[data-testid=ConnectionDriverFields_server]').clear().type('mysql');
|
|
||||||
} else {
|
|
||||||
cy.get('[data-testid=ConnectionDriverFields_port]').clear().type('16004');
|
|
||||||
}
|
|
||||||
cy.get('[data-testid=ConnectionDriverFields_displayName]').clear().type('test-mysql-1');
|
cy.get('[data-testid=ConnectionDriverFields_displayName]').clear().type('test-mysql-1');
|
||||||
|
|
||||||
// test connection
|
// test connection
|
||||||
@@ -32,8 +26,6 @@ describe('Add connection', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('SSH connection - user + password', () => {
|
it('SSH connection - user + password', () => {
|
||||||
const runOnCI = Cypress.env('runOnCI');
|
|
||||||
|
|
||||||
cy.visit('http://localhost:3000');
|
cy.visit('http://localhost:3000');
|
||||||
cy.contains('Connections');
|
cy.contains('Connections');
|
||||||
|
|
||||||
@@ -52,19 +44,13 @@ describe('Add connection', () => {
|
|||||||
cy.get('[data-testid=ConnectionSshTunnelFields_useSshTunnel]').check();
|
cy.get('[data-testid=ConnectionSshTunnelFields_useSshTunnel]').check();
|
||||||
cy.get('[data-testid=ConnectionSshTunnelFields_sshLogin]').clear().type('root');
|
cy.get('[data-testid=ConnectionSshTunnelFields_sshLogin]').clear().type('root');
|
||||||
cy.get('[data-testid=ConnectionSshTunnelFields_sshPassword]').clear().type('root');
|
cy.get('[data-testid=ConnectionSshTunnelFields_sshPassword]').clear().type('root');
|
||||||
if (runOnCI) {
|
cy.get('[data-testid=ConnectionSshTunnelFields_sshPort]').clear().type('16006');
|
||||||
cy.get('[data-testid=ConnectionSshTunnelFields_sshHost]').clear().type('mysql-ssh-login');
|
|
||||||
} else {
|
|
||||||
cy.get('[data-testid=ConnectionSshTunnelFields_sshPort]').clear().type('16006');
|
|
||||||
}
|
|
||||||
cy.get('[data-testid=ConnectionTab_buttonSave]').click();
|
cy.get('[data-testid=ConnectionTab_buttonSave]').click();
|
||||||
cy.get('[data-testid=ConnectionTab_buttonConnect]').click();
|
cy.get('[data-testid=ConnectionTab_buttonConnect]').click();
|
||||||
cy.contains('performance_schema');
|
cy.contains('performance_schema');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('SSH connection - keyfile', () => {
|
it('SSH connection - keyfile', () => {
|
||||||
const runOnCI = Cypress.env('runOnCI');
|
|
||||||
|
|
||||||
cy.visit('http://localhost:3000');
|
cy.visit('http://localhost:3000');
|
||||||
cy.contains('Connections');
|
cy.contains('Connections');
|
||||||
|
|
||||||
@@ -87,30 +73,20 @@ describe('Add connection', () => {
|
|||||||
cy.get('[data-testid=ConnectionSshTunnelFields_sshKeyfile]')
|
cy.get('[data-testid=ConnectionSshTunnelFields_sshKeyfile]')
|
||||||
.clear()
|
.clear()
|
||||||
.type(path.join(Cypress.config('fileServerFolder'), 'cypress', 'e2e', 'mykey'));
|
.type(path.join(Cypress.config('fileServerFolder'), 'cypress', 'e2e', 'mykey'));
|
||||||
if (runOnCI) {
|
cy.get('[data-testid=ConnectionSshTunnelFields_sshPort]').clear().type('16008');
|
||||||
cy.get('[data-testid=ConnectionSshTunnelFields_sshHost]').clear().type('mysql-ssh-keyfile');
|
|
||||||
} else {
|
|
||||||
cy.get('[data-testid=ConnectionSshTunnelFields_sshPort]').clear().type('16008');
|
|
||||||
}
|
|
||||||
cy.get('[data-testid=ConnectionTab_buttonSave]').click();
|
cy.get('[data-testid=ConnectionTab_buttonSave]').click();
|
||||||
cy.get('[data-testid=ConnectionTab_buttonConnect]').click();
|
cy.get('[data-testid=ConnectionTab_buttonConnect]').click();
|
||||||
cy.contains('performance_schema');
|
cy.contains('performance_schema');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ask password - mysql', () => {
|
it('ask password - mysql', () => {
|
||||||
const runOnCI = Cypress.env('runOnCI');
|
|
||||||
|
|
||||||
cy.visit('http://localhost:3000');
|
cy.visit('http://localhost:3000');
|
||||||
|
|
||||||
cy.get('[data-testid=ConnectionList_buttonNewConnection]').click();
|
cy.get('[data-testid=ConnectionList_buttonNewConnection]').click();
|
||||||
cy.get('[data-testid=ConnectionDriverFields_connectionType]').select('MySQL');
|
cy.get('[data-testid=ConnectionDriverFields_connectionType]').select('MySQL');
|
||||||
cy.get('[data-testid=ConnectionDriverFields_user]').clear().type('root');
|
cy.get('[data-testid=ConnectionDriverFields_user]').clear().type('root');
|
||||||
cy.get('[data-testid=ConnectionDriverFields_password]').clear().type('Pwd2020Db');
|
cy.get('[data-testid=ConnectionDriverFields_password]').clear().type('Pwd2020Db');
|
||||||
if (runOnCI) {
|
cy.get('[data-testid=ConnectionDriverFields_port]').clear().type('16004');
|
||||||
cy.get('[data-testid=ConnectionDriverFields_server]').clear().type('mysql');
|
|
||||||
} else {
|
|
||||||
cy.get('[data-testid=ConnectionDriverFields_port]').clear().type('16004');
|
|
||||||
}
|
|
||||||
cy.get('[data-testid=ConnectionDriverFields_displayName]').clear().type('test-mysql-2');
|
cy.get('[data-testid=ConnectionDriverFields_displayName]').clear().type('test-mysql-2');
|
||||||
cy.testid('ConnectionDriverFields_passwordMode').select('askPassword');
|
cy.testid('ConnectionDriverFields_passwordMode').select('askPassword');
|
||||||
|
|
||||||
|
|||||||
@@ -2,20 +2,10 @@ describe('OAuth', () => {
|
|||||||
it('OAuth login', () => {
|
it('OAuth login', () => {
|
||||||
cy.visit('http://localhost:3000');
|
cy.visit('http://localhost:3000');
|
||||||
|
|
||||||
const runOnCI = Cypress.env('runOnCI');
|
|
||||||
|
|
||||||
// login on DEX
|
// login on DEX
|
||||||
if (runOnCI) {
|
cy.get('#login').clear().type('test@example.com');
|
||||||
cy.origin('http://dex:5556', () => {
|
cy.get('#password').clear().type('test');
|
||||||
cy.get('#login').clear().type('test@example.com');
|
cy.get('#submit-login').click();
|
||||||
cy.get('#password').clear().type('test');
|
|
||||||
cy.get('#submit-login').click();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
cy.get('#login').clear().type('test@example.com');
|
|
||||||
cy.get('#password').clear().type('test');
|
|
||||||
cy.get('#submit-login').click();
|
|
||||||
}
|
|
||||||
|
|
||||||
// check DbGate connection
|
// check DbGate connection
|
||||||
cy.contains('MySql-connection').click();
|
cy.contains('MySql-connection').click();
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
issuer: http://localhost:16009/dex
|
|
||||||
storage:
|
|
||||||
type: memory
|
|
||||||
web:
|
|
||||||
http: 0.0.0.0:5556
|
|
||||||
|
|
||||||
oauth2:
|
|
||||||
skipApprovalScreen: true
|
|
||||||
|
|
||||||
staticClients:
|
|
||||||
- id: my-app
|
|
||||||
redirectURIs:
|
|
||||||
- 'http://localhost:3000/'
|
|
||||||
name: 'My Test App'
|
|
||||||
secret: my-secret
|
|
||||||
|
|
||||||
enablePasswordDB: true
|
|
||||||
staticPasswords:
|
|
||||||
- email: "test@example.com"
|
|
||||||
hash: "$2y$10$JcmlXnV1y7.egUdKwYNbseOnqYVIGc323gtvvHh4ZuSPZB30veYZy"
|
|
||||||
username: "test"
|
|
||||||
userID: "1234"
|
|
||||||
@@ -22,19 +22,16 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 16005:3306
|
- 16005:3306
|
||||||
- 16006:22
|
- "16006:22"
|
||||||
|
|
||||||
mysql-ssh-keyfile:
|
mysql-ssh-keyfile:
|
||||||
build: containers/mysql-ssh-keyfile
|
build: containers/mysql-ssh-keyfile
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 16007:3306
|
- 16007:3306
|
||||||
- 16008:22
|
- "16008:22"
|
||||||
|
|
||||||
dex:
|
dex:
|
||||||
image: dexidp/dex:v2.35.3
|
build: containers/dex
|
||||||
ports:
|
ports:
|
||||||
- "16009:5556"
|
- "16009:5556"
|
||||||
volumes:
|
|
||||||
- ./dex-config.yaml:/etc/dex/cfg/config.yaml
|
|
||||||
command: ["dex", "serve", "/etc/dex/cfg/config.yaml"]
|
|
||||||
|
|||||||
15
e2e-tests/env/oauth-ci/.env
vendored
15
e2e-tests/env/oauth-ci/.env
vendored
@@ -1,15 +0,0 @@
|
|||||||
CONNECTIONS=mysql
|
|
||||||
|
|
||||||
LABEL_mysql=MySql-connection
|
|
||||||
SERVER_mysql=mysql
|
|
||||||
USER_mysql=root
|
|
||||||
PASSWORD_mysql=Pwd2020Db
|
|
||||||
PORT_mysql=3306
|
|
||||||
ENGINE_mysql=mysql@dbgate-plugin-mysql
|
|
||||||
|
|
||||||
OAUTH_AUTH=http://dex:5556/dex/auth
|
|
||||||
OAUTH_TOKEN=http://dex:5556/dex/token
|
|
||||||
OAUTH_CLIENT_ID=my-app
|
|
||||||
OAUTH_CLIENT_SECRET=my-secret
|
|
||||||
OAUTH_LOGIN_FIELD=username
|
|
||||||
OAUTH_SCOPE=openid
|
|
||||||
22
e2e-tests/env/portal-ci/.env
vendored
22
e2e-tests/env/portal-ci/.env
vendored
@@ -1,22 +0,0 @@
|
|||||||
CONNECTIONS=mysql,postgres,pgask
|
|
||||||
|
|
||||||
LABEL_mysql=MySql-connection
|
|
||||||
SERVER_mysql=mysql
|
|
||||||
USER_mysql=root
|
|
||||||
PASSWORD_mysql=Pwd2020Db
|
|
||||||
PORT_mysql=3306
|
|
||||||
ENGINE_mysql=mysql@dbgate-plugin-mysql
|
|
||||||
|
|
||||||
LABEL_postgres=Postgres-connection
|
|
||||||
SERVER_postgres=postgres
|
|
||||||
USER_postgres=postgres
|
|
||||||
PASSWORD_postgres=Pwd2020Db
|
|
||||||
PORT_postgres=5432
|
|
||||||
ENGINE_postgres=postgres@dbgate-plugin-postgres
|
|
||||||
|
|
||||||
LABEL_pgask=Postgres-ask-connection
|
|
||||||
SERVER_pgask=postgres
|
|
||||||
USER_pgask=postgres
|
|
||||||
PORT_pgask=5432
|
|
||||||
ENGINE_pgask=postgres@dbgate-plugin-postgres
|
|
||||||
PASSWORD_MODE_pgask=askUser
|
|
||||||
@@ -15,24 +15,15 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"cy:open": "cypress open --config experimentalInteractiveRunEvents=true",
|
"cy:open": "cypress open --config experimentalInteractiveRunEvents=true",
|
||||||
|
|
||||||
"cy:run:add-connection:local": "cypress run --spec cypress/e2e/add-connection.cy.js",
|
"cy:run:add-connection": "cypress run --spec cypress/e2e/add-connection.cy.js",
|
||||||
"cy:run:add-connection:ci": "cypress run --env runOnCI=true --spec cypress/e2e/add-connection.cy.js",
|
"cy:run:portal": "cypress run --spec cypress/e2e/portal.cy.js",
|
||||||
|
"cy:run:oauth": "cypress run --spec cypress/e2e/oauth.cy.js",
|
||||||
"cy:run:portal:local": "cypress run --spec cypress/e2e/portal.cy.js",
|
|
||||||
"cy:run:portal:ci": "cypress run --env runOnCI=true --spec cypress/e2e/portal.cy.js",
|
|
||||||
|
|
||||||
"cy:run:oauth:local": "cypress run --spec cypress/e2e/oauth.cy.js",
|
|
||||||
"cy:run:oauth:ci": "cypress run --env runOnCI=true --spec cypress/e2e/oauth.cy.js",
|
|
||||||
|
|
||||||
"start:add-connection": "cd .. && node packer/build/bundle.js --listen-api --run-e2e-tests",
|
"start:add-connection": "cd .. && node packer/build/bundle.js --listen-api --run-e2e-tests",
|
||||||
|
"start:portal": "cd .. && env-cmd -f e2e-tests/env/portal/.env node e2e-tests/init/portal.js && env-cmd -f e2e-tests/env/portal/.env node packer/build/bundle.js --listen-api --run-e2e-tests",
|
||||||
|
"start:oauth": "cd .. && env-cmd -f e2e-tests/env/oauth/.env node packer/build/bundle.js --listen-api --run-e2e-tests",
|
||||||
|
|
||||||
"start:portal:local": "cd .. && env-cmd -f e2e-tests/env/portal-local/.env node e2e-tests/init/portal.js && env-cmd -f e2e-tests/env/portal-local/.env node packer/build/bundle.js --listen-api --run-e2e-tests",
|
"test": "start-server-and-test start:add-connection http://localhost:3000 cy:run:add-connection && start-server-and-test start:portal http://localhost:3000 cy:run:portal && start-server-and-test start:oauth http://localhost:3000 cy:run:oauth",
|
||||||
"start:portal:ci": "cd .. && env-cmd -f e2e-tests/env/portal-ci/.env node e2e-tests/init/portal.js && env-cmd -f e2e-tests/env/portal-ci/.env node packer/build/bundle.js --listen-api --run-e2e-tests",
|
"test:ci": "yarn test"
|
||||||
|
|
||||||
"start:oauth:local": "cd .. && env-cmd -f e2e-tests/env/oauth-local/.env node packer/build/bundle.js --listen-api --run-e2e-tests",
|
|
||||||
"start:oauth:ci": "cd .. && env-cmd -f e2e-tests/env/oauth-ci/.env node packer/build/bundle.js --listen-api --run-e2e-tests",
|
|
||||||
|
|
||||||
"test:ci": "start-server-and-test start:add-connection http://localhost:3000 cy:run:add-connection:ci && start-server-and-test start:portal:ci http://localhost:3000 cy:run:portal:ci && start-server-and-test start:oauth:ci http://localhost:3000 cy:run:oauth:ci",
|
|
||||||
"test:local": "start-server-and-test start:add-connection http://localhost:3000 cy:run:add-connection:local && start-server-and-test start:portal:local http://localhost:3000 cy:run:portal:local && start-server-and-test start:oauth:local http://localhost:3000 cy:run:oauth:local"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,21 +9,8 @@ function randomDbName(dialect) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractConnection(engine) {
|
|
||||||
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) {
|
||||||
@@ -48,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) {
|
||||||
@@ -97,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 {
|
||||||
|
|||||||
@@ -10,13 +10,12 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: node:18
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install dependencies for cypress
|
- name: Use Node.js 18.x
|
||||||
run: |
|
uses: actions/setup-node@v1
|
||||||
apt-get update
|
with:
|
||||||
apt-get install -y xvfb libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6
|
node-version: 18.x
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@@ -79,7 +78,7 @@ jobs:
|
|||||||
action-name: Datalib (perspectives) test results
|
action-name: Datalib (perspectives) test results
|
||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres-integr:
|
||||||
image: postgres
|
image: postgres
|
||||||
env:
|
env:
|
||||||
POSTGRES_PASSWORD: Pwd2020Db
|
POSTGRES_PASSWORD: Pwd2020Db
|
||||||
@@ -88,34 +87,70 @@ jobs:
|
|||||||
--health-interval 10s
|
--health-interval 10s
|
||||||
--health-timeout 5s
|
--health-timeout 5s
|
||||||
--health-retries 5
|
--health-retries 5
|
||||||
|
ports:
|
||||||
|
- 15000:5432
|
||||||
|
|
||||||
mysql:
|
mysql-integr:
|
||||||
image: mysql:8.0.18
|
image: mysql:8.0.18
|
||||||
env:
|
env:
|
||||||
MYSQL_ROOT_PASSWORD: Pwd2020Db
|
MYSQL_ROOT_PASSWORD: Pwd2020Db
|
||||||
|
ports:
|
||||||
|
- 15001:3306
|
||||||
|
|
||||||
mssql:
|
mssql-integr:
|
||||||
image: mcr.microsoft.com/mssql/server
|
image: mcr.microsoft.com/mssql/server
|
||||||
env:
|
env:
|
||||||
ACCEPT_EULA: Y
|
ACCEPT_EULA: Y
|
||||||
SA_PASSWORD: Pwd2020Db
|
SA_PASSWORD: Pwd2020Db
|
||||||
MSSQL_PID: Express
|
MSSQL_PID: Express
|
||||||
|
ports:
|
||||||
|
- 15002:1433
|
||||||
|
|
||||||
clickhouse:
|
clickhouse-integr:
|
||||||
image: bitnami/clickhouse:24.8.4
|
image: bitnami/clickhouse:24.8.4
|
||||||
env:
|
env:
|
||||||
CLICKHOUSE_ADMIN_PASSWORD: Pwd2020Db
|
CLICKHOUSE_ADMIN_PASSWORD: Pwd2020Db
|
||||||
|
ports:
|
||||||
|
- 15005:8123
|
||||||
|
|
||||||
oracle:
|
oracle-integr:
|
||||||
image: gvenzl/oracle-xe:21-slim
|
image: gvenzl/oracle-xe:21-slim
|
||||||
env:
|
env:
|
||||||
ORACLE_PASSWORD: Pwd2020Db
|
ORACLE_PASSWORD: Pwd2020Db
|
||||||
|
ports:
|
||||||
|
- 15006:1521
|
||||||
|
|
||||||
|
|
||||||
|
postgres-cypress:
|
||||||
|
image: postgres
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
env:
|
||||||
|
POSTGRES_PASSWORD: Pwd2020Db
|
||||||
|
ports:
|
||||||
|
- 16000:5432
|
||||||
|
|
||||||
|
mysql-cypress:
|
||||||
|
image: mysql:8.0.18
|
||||||
|
ports:
|
||||||
|
- 16004:3306
|
||||||
|
env:
|
||||||
|
MYSQL_ROOT_PASSWORD: Pwd2020Db
|
||||||
|
|
||||||
mysql-ssh-login:
|
mysql-ssh-login:
|
||||||
image: ghcr.io/dbgate/mysql-ssh-login:latest
|
image: ghcr.io/dbgate/mysql-ssh-login:latest
|
||||||
|
ports:
|
||||||
|
- '16006:22'
|
||||||
|
|
||||||
mysql-ssh-keyfile:
|
mysql-ssh-keyfile:
|
||||||
image: ghcr.io/dbgate/mysql-ssh-keyfile:latest
|
image: ghcr.io/dbgate/mysql-ssh-keyfile:latest
|
||||||
|
ports:
|
||||||
|
- '16008:22'
|
||||||
|
|
||||||
dex:
|
dex:
|
||||||
image: ghcr.io/dbgate/dex:latest
|
image: ghcr.io/dbgate/dex:latest
|
||||||
|
ports:
|
||||||
|
- 16009:5556
|
||||||
|
|||||||
Reference in New Issue
Block a user