-
Notifications
You must be signed in to change notification settings - Fork 803
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove Oracle database support (#641)
- Loading branch information
Showing
13 changed files
with
6 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,18 +60,6 @@ jobs: | |
ports: | ||
- 6379 | ||
|
||
oracle: | ||
image: gvenzl/oracle-xe:18 | ||
ports: | ||
- 1521 | ||
env: | ||
ORACLE_PASSWORD: password | ||
options: >- | ||
--health-cmd healthcheck.sh | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 10 | ||
steps: | ||
- name: Set up dataset | ||
run: | | ||
|
@@ -123,8 +111,6 @@ jobs: | |
CLICKHOUSE_URI: clickhouse://localhost:${{ job.services.clickhouse.ports[8123] }}/ | ||
# Redis | ||
REDIS_URI: redis://localhost:${{ job.services.redis.ports[6379] }}/ | ||
# Oracle | ||
ORACLE_URI: oracle://system:[email protected]:${{ job.services.oracle.ports[1521] }}/XE | ||
|
||
- name: Upload | ||
run: bash <(curl -s https://codecov.io/bash) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,6 @@ The default database URLs are directed to these databases in `storage/docker-com | |
| `POSTGRES_URI` | `postgres://gorse:[email protected]/` | | ||
| `MONGO_URI` | `mongodb://root:[email protected]:27017/` | | ||
| `CLICKHOUSE_URI` | `clickhouse://127.0.0.1:8123/` | | ||
| `ORACLE_URI` | `oracle://system:[email protected]:1521/XE` | | ||
| `REDIS_URI` | `redis://127.0.0.1:6379/` | | ||
|
||
For example, use TiDB as a test database by: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,6 @@ const ( | |
MySQL SQLDriver = iota | ||
Postgres | ||
SQLite | ||
Oracle | ||
) | ||
|
||
type SQLValue struct { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ package cache | |
import ( | ||
"database/sql" | ||
"fmt" | ||
"net/url" | ||
"os" | ||
"strings" | ||
"testing" | ||
|
@@ -30,7 +29,6 @@ import ( | |
var ( | ||
mySqlDSN string | ||
postgresDSN string | ||
oracleDSN string | ||
) | ||
|
||
func init() { | ||
|
@@ -43,7 +41,6 @@ func init() { | |
} | ||
mySqlDSN = env("MYSQL_URI", "mysql://root:password@tcp(127.0.0.1:3306)/") | ||
postgresDSN = env("POSTGRES_URI", "postgres://gorse:[email protected]/") | ||
oracleDSN = env("ORACLE_URI", "oracle://system:[email protected]:1521/XE") | ||
} | ||
|
||
type PostgresTestSuite struct { | ||
|
@@ -111,45 +108,6 @@ func TestMySQL(t *testing.T) { | |
suite.Run(t, new(MySQLTestSuite)) | ||
} | ||
|
||
type OracleTestSuite struct { | ||
baseTestSuite | ||
} | ||
|
||
func (suite *OracleTestSuite) SetupSuite() { | ||
var err error | ||
// create database | ||
databaseComm, err := sql.Open("oracle", oracleDSN) | ||
suite.NoError(err) | ||
const dbName = "GORSE_CACHE_TEST" | ||
rows, err := databaseComm.Query("select * from dba_users where username=:1", dbName) | ||
suite.NoError(err) | ||
if rows.Next() { | ||
// drop user if exists | ||
_, err = databaseComm.Exec(fmt.Sprintf("DROP USER %s CASCADE", dbName)) | ||
suite.NoError(err) | ||
} | ||
err = rows.Close() | ||
suite.NoError(err) | ||
_, err = databaseComm.Exec(fmt.Sprintf("CREATE USER %s IDENTIFIED BY %s", dbName, dbName)) | ||
suite.NoError(err) | ||
_, err = databaseComm.Exec(fmt.Sprintf("GRANT ALL PRIVILEGES TO %s", dbName)) | ||
suite.NoError(err) | ||
err = databaseComm.Close() | ||
suite.NoError(err) | ||
// connect database | ||
parsed, err := url.Parse(oracleDSN) | ||
suite.NoError(err) | ||
suite.Database, err = Open(fmt.Sprintf("oracle://%s:%s@%s/%s", dbName, dbName, parsed.Host, parsed.Path), "gorse_") | ||
suite.NoError(err) | ||
// create schema | ||
err = suite.Database.Init() | ||
suite.NoError(err) | ||
} | ||
|
||
func TestOracle(t *testing.T) { | ||
suite.Run(t, new(OracleTestSuite)) | ||
} | ||
|
||
type SQLiteTestSuite struct { | ||
baseTestSuite | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ package data | |
import ( | ||
"database/sql" | ||
"fmt" | ||
"net/url" | ||
"os" | ||
"strings" | ||
"testing" | ||
|
@@ -31,7 +30,6 @@ var ( | |
mySqlDSN string | ||
postgresDSN string | ||
clickhouseDSN string | ||
oracleDSN string | ||
) | ||
|
||
func init() { | ||
|
@@ -45,7 +43,6 @@ func init() { | |
mySqlDSN = env("MYSQL_URI", "mysql://root:password@tcp(127.0.0.1:3306)/") | ||
postgresDSN = env("POSTGRES_URI", "postgres://gorse:[email protected]/") | ||
clickhouseDSN = env("CLICKHOUSE_URI", "clickhouse://127.0.0.1:8123/") | ||
oracleDSN = env("ORACLE_URI", "oracle://system:[email protected]:1521/XE") | ||
} | ||
|
||
type MySQLTestSuite struct { | ||
|
@@ -139,45 +136,6 @@ func TestClickHouse(t *testing.T) { | |
suite.Run(t, new(ClickHouseTestSuite)) | ||
} | ||
|
||
type OracleTestSuite struct { | ||
baseTestSuite | ||
} | ||
|
||
func (suite *OracleTestSuite) SetupSuite() { | ||
var err error | ||
// create database | ||
databaseComm, err := sql.Open("oracle", oracleDSN) | ||
suite.NoError(err) | ||
const dbName = "GORSE_DATA_TEST" | ||
rows, err := databaseComm.Query("select * from dba_users where username=:1", dbName) | ||
suite.NoError(err) | ||
if rows.Next() { | ||
// drop user if exists | ||
_, err = databaseComm.Exec(fmt.Sprintf("DROP USER %s CASCADE", dbName)) | ||
suite.NoError(err) | ||
} | ||
err = rows.Close() | ||
suite.NoError(err) | ||
_, err = databaseComm.Exec(fmt.Sprintf("CREATE USER %s IDENTIFIED BY %s", dbName, dbName)) | ||
suite.NoError(err) | ||
_, err = databaseComm.Exec(fmt.Sprintf("GRANT ALL PRIVILEGES TO %s", dbName)) | ||
suite.NoError(err) | ||
err = databaseComm.Close() | ||
suite.NoError(err) | ||
// connect database | ||
parsed, err := url.Parse(oracleDSN) | ||
suite.NoError(err) | ||
suite.Database, err = Open(fmt.Sprintf("oracle://%s:%s@%s/%s", dbName, dbName, parsed.Host, parsed.Path), "gorse_") | ||
suite.NoError(err) | ||
// create schema | ||
err = suite.Database.Init() | ||
suite.NoError(err) | ||
} | ||
|
||
func TestOracle(t *testing.T) { | ||
suite.Run(t, new(OracleTestSuite)) | ||
} | ||
|
||
type SQLiteTestSuite struct { | ||
baseTestSuite | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters