mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-29 21:31:02 +00:00
added unit tests for postgres and mysql
This commit is contained in:
parent
892703b3f2
commit
6b721f5b98
4 changed files with 15 additions and 3 deletions
|
@ -8,7 +8,12 @@ script:
|
||||||
- sudo apt-get -y install zip libsqlite3-dev sqlite3 1> /dev/null 2> /dev/null
|
- sudo apt-get -y install zip libsqlite3-dev sqlite3 1> /dev/null 2> /dev/null
|
||||||
- make deps
|
- make deps
|
||||||
- make test
|
- make test
|
||||||
|
- make test_postgres
|
||||||
|
- make test_mysql
|
||||||
- make dpkg
|
- make dpkg
|
||||||
|
services:
|
||||||
|
- postgres
|
||||||
|
- mysql
|
||||||
notify:
|
notify:
|
||||||
email:
|
email:
|
||||||
recipients:
|
recipients:
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -12,6 +12,13 @@ test:
|
||||||
go vet ./...
|
go vet ./...
|
||||||
go test -cover -short ./...
|
go test -cover -short ./...
|
||||||
|
|
||||||
|
test_mysql:
|
||||||
|
mysql -P 3306 --protocol=tcp -u root -e 'create database test;'
|
||||||
|
TEST_DRIVER="mysql" TEST_DATASOURCE="root@tcp(127.0.0.1:3306)/test" go test -short github.com/drone/drone/server/datastore/database
|
||||||
|
|
||||||
|
test_postgres:
|
||||||
|
TEST_DRIVER="postgres" TEST_DATASOURCE="host=127.0.0.1 user=postgres dbname=postgres sslmode=disable" go test -short github.com/drone/drone/server/datastore/database
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -o debian/drone/usr/local/bin/drone -ldflags "-X main.revision $(SHA)" github.com/drone/drone/cli
|
go build -o debian/drone/usr/local/bin/drone -ldflags "-X main.revision $(SHA)" github.com/drone/drone/cli
|
||||||
go build -o debian/drone/usr/local/bin/droned -ldflags "-X main.revision $(SHA)" github.com/drone/drone/server
|
go build -o debian/drone/usr/local/bin/droned -ldflags "-X main.revision $(SHA)" github.com/drone/drone/server
|
||||||
|
|
|
@ -111,7 +111,7 @@ CREATE TABLE IF NOT EXISTS commits (
|
||||||
var blobTable = `
|
var blobTable = `
|
||||||
CREATE TABLE IF NOT EXISTS blobs (
|
CREATE TABLE IF NOT EXISTS blobs (
|
||||||
blob_id INTEGER PRIMARY KEY AUTOINCREMENT
|
blob_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||||||
,blob_path VARCHAR(1024)
|
,blob_path VARCHAR(255)
|
||||||
,blob_data BLOB
|
,blob_data BLOB
|
||||||
,UNIQUE(blob_path)
|
,UNIQUE(blob_path)
|
||||||
);
|
);
|
||||||
|
|
|
@ -74,10 +74,10 @@ func main() {
|
||||||
|
|
||||||
flag.StringVar(&conf, "config", "", "")
|
flag.StringVar(&conf, "config", "", "")
|
||||||
flag.StringVar(&prefix, "prefix", "DRONE_", "")
|
flag.StringVar(&prefix, "prefix", "DRONE_", "")
|
||||||
flag.StringVar(&driver, "driver", "sqlite3", "")
|
|
||||||
flag.StringVar(&datasource, "datasource", "drone.sqlite", "")
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
config.StringVar(&datasource, "database-path", "drone.sqlite")
|
||||||
|
config.StringVar(&driver, "database-driver", "sqlite3")
|
||||||
config.Var(&nodes, "worker-nodes")
|
config.Var(&nodes, "worker-nodes")
|
||||||
config.BoolVar(&open, "registration-open", false)
|
config.BoolVar(&open, "registration-open", false)
|
||||||
config.SetPrefix(prefix)
|
config.SetPrefix(prefix)
|
||||||
|
|
Loading…
Reference in a new issue