mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 23:45:59 +00:00
oauth test WIP
This commit is contained in:
7
.github/workflows/build-test-containers.yaml
vendored
7
.github/workflows/build-test-containers.yaml
vendored
@@ -22,6 +22,9 @@ jobs:
|
||||
- name: Build mysql-ssh-keyfile image
|
||||
run: |
|
||||
docker build -t dbgate/mysql-ssh-keyfile:latest e2e-tests/containers/mysql-ssh-keyfile
|
||||
- name: Build dex image
|
||||
run: |
|
||||
docker build -t dbgate/dex:latest e2e-tests/containers/dex
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
@@ -36,3 +39,7 @@ jobs:
|
||||
run: |
|
||||
docker tag dbgate/mysql-ssh-keyfile:latest ghcr.io/dbgate/mysql-ssh-keyfile:latest
|
||||
docker push ghcr.io/dbgate/mysql-ssh-keyfile:latest
|
||||
- name: Push dex to GHCR
|
||||
run: |
|
||||
docker tag dbgate/dex:latest ghcr.io/dbgate/dex:latest
|
||||
docker push ghcr.io/dbgate/dex:latest
|
||||
|
||||
2
.github/workflows/run-tests.yaml
vendored
2
.github/workflows/run-tests.yaml
vendored
@@ -94,3 +94,5 @@ jobs:
|
||||
image: 'ghcr.io/dbgate/mysql-ssh-login:latest'
|
||||
mysql-ssh-keyfile:
|
||||
image: 'ghcr.io/dbgate/mysql-ssh-keyfile:latest'
|
||||
dex:
|
||||
image: 'ghcr.io/dbgate/dex:latest'
|
||||
|
||||
7
e2e-tests/containers/dex/Dockerfile
Normal file
7
e2e-tests/containers/dex/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM dexidp/dex:v2.35.3
|
||||
|
||||
COPY ./dex-config.yaml /etc/dex/cfg/config.yaml
|
||||
|
||||
EXPOSE 5556
|
||||
|
||||
CMD ["dex", "serve", "/etc/dex/cfg/config.yaml"]
|
||||
22
e2e-tests/containers/dex/dex-config.yaml
Normal file
22
e2e-tests/containers/dex/dex-config.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
issuer: http://dex:5556/dex
|
||||
storage:
|
||||
type: memory
|
||||
web:
|
||||
http: 0.0.0.0:5556
|
||||
|
||||
oauth2:
|
||||
skipApprovalScreen: true
|
||||
|
||||
staticClients:
|
||||
- id: my-app
|
||||
redirectURIs:
|
||||
- 'http://localhost:3000/callback'
|
||||
name: 'My Test App'
|
||||
secret: my-secret
|
||||
|
||||
enablePasswordDB: true
|
||||
staticPasswords:
|
||||
- email: "test@example.com"
|
||||
hash: "$2y$05$olu30d4lgn7r1/Xfe13N1.5dz0N9AVlKXUFIxXUYVkhiq8D6gwYGG"
|
||||
username: "test"
|
||||
userID: "1234"
|
||||
@@ -22,6 +22,9 @@ module.exports = defineConfig({
|
||||
case 'portal':
|
||||
serverProcess = exec('yarn start:portal:local');
|
||||
break;
|
||||
case 'oauth':
|
||||
serverProcess = exec('yarn start:oauth:local');
|
||||
break;
|
||||
}
|
||||
|
||||
await waitOn({ resources: ['http://localhost:3000'] });
|
||||
|
||||
14
e2e-tests/cypress/e2e/oauth.cy.js
Normal file
14
e2e-tests/cypress/e2e/oauth.cy.js
Normal file
@@ -0,0 +1,14 @@
|
||||
describe('OAuth', () => {
|
||||
it('OAuth login', () => {
|
||||
cy.visit('http://localhost:3000');
|
||||
|
||||
// login on DEX
|
||||
cy.get('#login').clear().type('test@example.com');
|
||||
cy.get('#password').clear().type('test');
|
||||
cy.get('#submit-login').click();
|
||||
|
||||
// check DbGate connection
|
||||
cy.contains('MySql-connection').click();
|
||||
cy.contains('performance_schema');
|
||||
});
|
||||
});
|
||||
15
e2e-tests/env/oauth-ci/.env
vendored
Normal file
15
e2e-tests/env/oauth-ci/.env
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
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/dex/auth
|
||||
OAUTH_TOKEN=http://dex/dex/token
|
||||
OAUTH_CLIENT_ID=my-app
|
||||
OAUTH_CLIENT_SECRET=my-secret
|
||||
OAUTH_LOGIN_FIELD=username
|
||||
OAUTH_SCOPE=openid
|
||||
1
e2e-tests/env/oauth-local/.env
vendored
1
e2e-tests/env/oauth-local/.env
vendored
@@ -12,3 +12,4 @@ OAUTH_TOKEN=http://localhost:16009/dex/token
|
||||
OAUTH_CLIENT_ID=my-app
|
||||
OAUTH_CLIENT_SECRET=my-secret
|
||||
OAUTH_LOGIN_FIELD=username
|
||||
OAUTH_SCOPE=openid
|
||||
@@ -24,6 +24,10 @@ jobs:
|
||||
run: |
|
||||
docker build -t dbgate/mysql-ssh-keyfile:latest e2e-tests/containers/mysql-ssh-keyfile
|
||||
|
||||
- name: Build dex image
|
||||
run: |
|
||||
docker build -t dbgate/dex:latest e2e-tests/containers/dex
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
@@ -40,3 +44,8 @@ jobs:
|
||||
run: |
|
||||
docker tag dbgate/mysql-ssh-keyfile:latest ghcr.io/dbgate/mysql-ssh-keyfile:latest
|
||||
docker push ghcr.io/dbgate/mysql-ssh-keyfile:latest
|
||||
|
||||
- name: Push dex to GHCR
|
||||
run: |
|
||||
docker tag dbgate/dex:latest ghcr.io/dbgate/dex:latest
|
||||
docker push ghcr.io/dbgate/dex:latest
|
||||
|
||||
@@ -116,3 +116,6 @@ jobs:
|
||||
|
||||
mysql-ssh-keyfile:
|
||||
image: ghcr.io/dbgate/mysql-ssh-keyfile:latest
|
||||
|
||||
dex:
|
||||
image: ghcr.io/dbgate/dex:latest
|
||||
|
||||
Reference in New Issue
Block a user