multiple databases testes on 1 TestMain

This commit is contained in:
Lunny Xiao 2017-05-27 19:14:47 +08:00
parent 0437b98eca
commit 01c460927d
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 2 additions and 3 deletions

View File

@ -21,9 +21,7 @@ database:
test:
override:
# './...' is a relative pattern which means all subdirectories
- go test -v -race -coverprofile=coverage.txt -covermode=atomic
- go test -v -race -db=mysql -conn_str="root:@/xorm_test" -coverprofile=coverage.txt -covermode=atomic
- go test -v -race -db=postgres -conn_str="dbname=xorm_test sslmode=disable" -coverprofile=coverage.txt -covermode=atomic
- go test -v -race -db="sqlite3;mysql;postgres" -conn_str="./test.db;root:@/xorm_test;dbname=xorm_test sslmode=disable" -coverprofile=coverage.txt -covermode=atomic
- cd /home/ubuntu/.go_workspace/src/github.com/go-xorm/tests && ./sqlite3.sh
- cd /home/ubuntu/.go_workspace/src/github.com/go-xorm/tests && ./mysql.sh
- cd /home/ubuntu/.go_workspace/src/github.com/go-xorm/tests && ./postgres.sh

View File

@ -78,6 +78,7 @@ func TestMain(m *testing.M) {
dbType = dbs[i]
connString = conns[i]
testEngine = nil
fmt.Println("testing", dbType, connString)
if err := prepareEngine(); err != nil {
fmt.Println(err)