From 8917d66571a95f3da232a0c27bc1300210d10fde Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 28 Jan 2019 16:18:52 +0000 Subject: Add migration test (#5773) * Add migration test This commit adds a simple migration test for v1.5.3, v1.6.4 and v1.7.0-rc3 Signed-off-by: Andrew Thornton * Automigrate based on available dbs * remove old ini file * Standardise the dialect names --- Makefile | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b27937b0c7..5201e99b04 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ endif LDFLAGS := -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)" -PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list ./... | grep -v /vendor/)) +PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list ./... | grep -v /vendor/))) SOURCES ?= $(shell find . -name "*.go" -type f) TAGS ?= @@ -197,6 +197,10 @@ test-vendor: vendor test-sqlite: integrations.sqlite.test GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test +.PHONY: test-sqlite-migration +test-sqlite-migration: migrations.sqlite.test + GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./migrations.sqlite.test + generate-ini: sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \ -e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \ @@ -218,14 +222,28 @@ generate-ini: test-mysql: integrations.test generate-ini GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.test +.PHONY: test-mysql-migration +test-mysql-migration: migrations.test generate-ini + GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./migrations.test + .PHONY: test-pgsql test-pgsql: integrations.test generate-ini GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test +.PHONY: test-pgsql-migration +test-pgsql-migration: migrations.test generate-ini + GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./migrations.test + + .PHONY: test-mssql test-mssql: integrations.test generate-ini GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.test +.PHONY: test-mssql-migration +test-mssql-migration: migrations.test generate-ini + GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./migrations.test + + .PHONY: bench-sqlite bench-sqlite: integrations.sqlite.test GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench . @@ -252,6 +270,14 @@ integrations.sqlite.test: $(SOURCES) integrations.cover.test: $(SOURCES) $(GO) test -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(PACKAGES) | tr ' ' ',') -o integrations.cover.test +.PHONY: migrations.test +migrations.test: $(SOURCES) + $(GO) test -c code.gitea.io/gitea/integrations/migration-test -o migrations.test + +.PHONY: migrations.sqlite.test +migrations.sqlite.test: $(SOURCES) + $(GO) test -c code.gitea.io/gitea/integrations/migration-test -o migrations.sqlite.test -tags 'sqlite sqlite_unlock_notify' + .PHONY: check check: test -- cgit v1.2.3