Skip to content

Commit 9f8ca78

Browse files
authored
add oracledb tests (#14)
1 parent 9a4443b commit 9f8ca78

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,28 @@ jobs:
7272
- run: npm i
7373
- run: npm test -t mssql-adapter
7474

75+
oracledb:
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: run sqlserver
79+
env:
80+
SA_PASSWORD: Casbin_db # The password must be at least 8 characters long and contain characters from three of the following four sets: Uppercase letters, Lowercase letters, Base 10 digits, and Symbols..
81+
run: |
82+
docker run --name sqlserver -it -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD='$SA_PASSWORD'' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest
83+
echo 'awaiting sqlserver bootup' && sleep 15 && echo 'lets try to logon'
84+
sqlcmd -S 127.0.0.1 -U sa -P $SA_PASSWORD -Q 'CREATE DATABASE casbin'
85+
sqlcmd -S 127.0.0.1 -U sa -P $SA_PASSWORD -Q 'SELECT name FROM master.dbo.sysdatabases'
86+
- name: run oracle
87+
run: |
88+
docker run --name oracle -it -d -p 1521:1521 -p 8080:8080 orangehrm/oracle-xe-11g
89+
echo 'awaiting oracle bootup' && sleep 15 && echo 'lets try to logon'
90+
docker run --interactive --link oracle:oracle guywithnose/sqlplus sqlplus system/oracle@oracle:1521/xe
91+
- uses: actions/checkout@v2
92+
- run: npm i
93+
- run: npm test -t oracledb-adapter
94+
7595
finish:
76-
needs: [fmt_lint, postgres, mysql_and_mysql2, sqlite3, mssql]
96+
needs: [fmt_lint, postgres, mysql_and_mysql2, sqlite3, mssql, oracledb]
7797
runs-on: ubuntu-latest
7898
steps:
7999
- uses: actions/checkout@v2

test/oracledb-adapter.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2020 The Casbin Authors. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import { getConnection } from 'oracledb';
16+
import Runner from './runner';
17+
18+
test(
19+
'oracledb adapter',
20+
Runner(
21+
'oracledb',
22+
getConnection({
23+
user: 'system',
24+
password: 'oracle',
25+
connectString: 'localhost:1521/xe',
26+
})
27+
),
28+
60 * 1000
29+
);

0 commit comments

Comments
 (0)