You've already forked woodpecker
							
							
				mirror of
				https://github.com/woodpecker-ci/woodpecker.git
				synced 2025-10-30 23:27:39 +02:00 
			
		
		
		
	added unit tests for postgres and mysql
This commit is contained in:
		| @@ -8,7 +8,12 @@ script: | ||||
|   - sudo apt-get -y install zip libsqlite3-dev sqlite3 1> /dev/null 2> /dev/null | ||||
|   - make deps | ||||
|   - make test | ||||
|   - make test_postgres | ||||
|   - make test_mysql | ||||
|   - make dpkg | ||||
| services: | ||||
|   - postgres | ||||
|   - mysql | ||||
| notify: | ||||
|   email: | ||||
|     recipients: | ||||
|   | ||||
							
								
								
									
										7
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								Makefile
									
									
									
									
									
								
							| @@ -12,6 +12,13 @@ test: | ||||
| 	go vet ./... | ||||
| 	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: | ||||
| 	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 | ||||
|   | ||||
| @@ -111,7 +111,7 @@ CREATE TABLE IF NOT EXISTS commits ( | ||||
| var blobTable = ` | ||||
| CREATE TABLE IF NOT EXISTS blobs ( | ||||
| 	 blob_id      INTEGER PRIMARY KEY AUTOINCREMENT | ||||
| 	,blob_path    VARCHAR(1024) | ||||
| 	,blob_path    VARCHAR(255) | ||||
| 	,blob_data    BLOB | ||||
| 	,UNIQUE(blob_path) | ||||
| ); | ||||
|   | ||||
| @@ -74,10 +74,10 @@ func main() { | ||||
|  | ||||
| 	flag.StringVar(&conf, "config", "", "") | ||||
| 	flag.StringVar(&prefix, "prefix", "DRONE_", "") | ||||
| 	flag.StringVar(&driver, "driver", "sqlite3", "") | ||||
| 	flag.StringVar(&datasource, "datasource", "drone.sqlite", "") | ||||
| 	flag.Parse() | ||||
|  | ||||
| 	config.StringVar(&datasource, "database-path", "drone.sqlite") | ||||
| 	config.StringVar(&driver, "database-driver", "sqlite3") | ||||
| 	config.Var(&nodes, "worker-nodes") | ||||
| 	config.BoolVar(&open, "registration-open", false) | ||||
| 	config.SetPrefix(prefix) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user