Add oracle tests #1463

Closed
lunny wants to merge 24 commits from lunny/test_oracle2 into master
5 changed files with 75 additions and 1 deletions
Showing only changes of commit 1e0921d455 - Show all commits

View File

@ -398,6 +398,58 @@ services:
# commands:
# - /bin/bash /startDm.sh
---
kind: pipeline
name: test-oracle
depends_on:
- test-cockroach
steps:
- name: test-oracle
pull: never
image: golang:1.15
volumes:
- name: cache
path: /go/pkg/mod
environment:
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
- name: test-oracle-schema
pull: never
image: golang:1.15
depends_on:
- test-oracle
volumes:
- name: cache
path: /go/pkg/mod
environment:
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
volumes:
- name: cache
host:
path: /tmp/cache
services:
- name: oracle
image: oracleinanutshell/oracle-xe-11g:latest
environment:
ORACLE_ALLOW_REMOTE: true
ORACLE_ENABLE_XDB: true
---
kind: pipeline
name: merge_coverage
@ -410,6 +462,7 @@ depends_on:
- test-tidb
- test-cockroach
#- test-dameng
- test-oracle
trigger:
ref:
- refs/heads/master

View File

@ -32,6 +32,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
@ -190,6 +196,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

@ -10,6 +10,7 @@ require (
github.com/jackc/pgx/v4 v4.12.0
github.com/json-iterator/go v1.1.11
github.com/lib/pq v1.10.2
github.com/mattn/go-oci8 v0.1.0
github.com/mattn/go-sqlite3 v1.14.8
github.com/shopspring/decimal v1.2.0
github.com/stretchr/testify v1.7.0

3
go.sum
View File

@ -245,6 +245,9 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-oci8 v0.1.0 h1:HnmdOy+/cLPN43obUokKka4hRE4b7Hp3U3E0fs1clp8=
github.com/mattn/go-oci8 v0.1.0/go.mod h1:wjDx6Xm9q7dFtHJvIlrI99JytznLw5wQ4R+9mNXJwGI=
github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU=
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=

View File

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