Add oracle on makefile and drone

This commit is contained in:
Lunny Xiao 2020-02-21 10:41:32 +08:00
parent a3412d6ba6
commit fb9f6a2e13
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
5 changed files with 113 additions and 1 deletions

View File

@ -109,6 +109,86 @@ steps:
- push
- pull_request
- name: test-oracle
pull: default
image: golang:1.12
environment:
GO111MODULE: "on"
GOPROXY: "https://goproxy.cn"
TEST_ORACLE_HOST: oracle:1521
TEST_ORACLE_DBNAME: xe
TEST_ORACLE_USERNAME: system
TEST_ORACLE_PASSWORD: oracle
TEST_CACHE_ENABLE: false
commands:
- make test-oracle
when:
event:
- push
- pull_request
- name: test-oracle-cache
pull: default
image: golang:1.12
depends_on:
- test-oracle
environment:
GO111MODULE: "on"
GOPROXY: "https://goproxy.cn"
TEST_ORACLE_HOST: oracle:1521
TEST_ORACLE_DBNAME: xe
TEST_ORACLE_USERNAME: system
TEST_ORACLE_PASSWORD: oracle
TEST_CACHE_ENABLE: true
commands:
- make test-oracle
when:
event:
- push
- pull_request
- name: test-oracle-schema
pull: default
image: golang:1.12
environment:
GO111MODULE: "on"
GOPROXY: "https://goproxy.cn"
TEST_ORACLE_SCHEMA: xorm
TEST_ORACLE_HOST: oracle:1521
TEST_ORACLE_DBNAME: xe
TEST_ORACLE_USERNAME: system
TEST_ORACLE_PASSWORD: oracle
TEST_CACHE_ENABLE: false
SCHEMA: xorm
commands:
- make test-oracle
when:
event:
- push
- pull_request
- name: test-oracle-schema-cache
pull: default
image: golang:1.12
depends_on:
- test-oracle-schema
environment:
GO111MODULE: "on"
GOPROXY: "https://goproxy.cn"
TEST_ORACLE_SCHEMA: xorm
TEST_ORACLE_HOST: oracle:1521
TEST_ORACLE_DBNAME: xe
TEST_ORACLE_USERNAME: system
TEST_ORACLE_PASSWORD: oracle
TEST_CACHE_ENABLE: true
SCHEMA: xorm
commands:
- make test-oracle
when:
event:
- push
- pull_request
- name: test-postgres
pull: default
image: golang:1.12
@ -292,6 +372,18 @@ services:
- tag
- pull_request
- name: oracle
pull: default
image: oracleinanutshell/oracle-xe-11g:latest
environment:
ORACLE_ALLOW_REMOTE: true
ORACLE_ENABLE_XDB: true
when:
event:
- push
- tag
- pull_request
- name: cockroach
pull: default
image: cockroachdb/cockroach:v19.2.4

View File

@ -27,6 +27,12 @@ TEST_MYSQL_DBNAME ?= xorm_test
TEST_MYSQL_USERNAME ?= root
TEST_MYSQL_PASSWORD ?=
TEST_ORACLE_HOST ?= oracle:1521
TEST_ORACLE_SCHEMA ?=
TEST_ORACLE_DBNAME ?= xe
TEST_ORACLE_USERNAME ?= system
TEST_ORACLE_PASSWORD ?= oracle
TEST_PGSQL_HOST ?= pgsql:5432
TEST_PGSQL_SCHEMA ?=
TEST_PGSQL_DBNAME ?= xorm_test
@ -176,6 +182,18 @@ test-mysql\#%: go-check
-conn_str="$(TEST_MYSQL_USERNAME):$(TEST_MYSQL_PASSWORD)@tcp($(TEST_MYSQL_HOST))/$(TEST_MYSQL_DBNAME)?charset=$(TEST_MYSQL_CHARSET)" \
-coverprofile=mysql.$(TEST_QUOTE_POLICY).$(TEST_CACHE_ENABLE).coverage.out -covermode=atomic
.PNONY: test-oracle
test-oracle: go-check
$(GO) test -race -tags=oracle -db=oci8 -schema='$(TEST_ORACLE_SCHEMA)' -cache=$(TEST_CACHE_ENABLE) \
-conn_str="$(TEST_ORACLE_USERNAME):$(TEST_ORACLE_PASSWORD)@$(TEST_ORACLE_HOST)/$(TEST_ORACLE_DBNAME)" \
-coverprofile=oracle.$(TEST_CACHE_ENABLE).coverage.out -covermode=atomic
.PHONY: test-oracle\#%
test-oralce\#%: go-check
$(GO) test -race -run $* -tags=oracle -db=oci8 -schema='$(TEST_PGSQL_SCHEMA)' -cache=$(TEST_CACHE_ENABLE) \
-conn_str="postgres://$(TEST_PGSQL_USERNAME):$(TEST_PGSQL_PASSWORD)@$(TEST_PGSQL_HOST)/$(TEST_PGSQL_DBNAME)" \
-coverprofile=oracle.$(TEST_CACHE_ENABLE).coverage.out -covermode=atomic
.PNONY: test-postgres
test-postgres: go-check
$(GO) test $(INTEGRATION_PACKAGES) -v -race -db=postgres -schema='$(TEST_PGSQL_SCHEMA)' -cache=$(TEST_CACHE_ENABLE) \

1
go.mod
View File

@ -7,6 +7,7 @@ require (
github.com/go-sql-driver/mysql v1.4.1
github.com/kr/pretty v0.1.0 // indirect
github.com/lib/pq v1.0.0
github.com/mattn/go-oci8 v0.0.4
github.com/mattn/go-sqlite3 v1.10.0
github.com/stretchr/testify v1.4.0
github.com/syndtr/goleveldb v1.0.0

2
go.sum
View File

@ -59,6 +59,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-oci8 v0.0.4 h1:3h8d3VE8buPHoEcApdEoww7Gy3G0SWhwJ0UpniYxBJU=
github.com/mattn/go-oci8 v0.0.4/go.mod h1:wjDx6Xm9q7dFtHJvIlrI99JytznLw5wQ4R+9mNXJwGI=
github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=

View File

@ -1 +0,0 @@
go test -tags=oracle -db=oci8 -conn_str="system/oracle@localhost:1521/xe"