summaryrefslogtreecommitdiffstats
path: root/integrations/migration-test
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-05-06 00:42:29 +0100
committerLauris BH <lauris@nix.lv>2019-05-06 02:42:29 +0300
commit0081cd8dfe34bcd9182ccebb406000c17dcb8025 (patch)
tree773754ab8283a4a9200a92ecac9d7082e22471fa /integrations/migration-test
parent722a2bd7ec742c7e421a33ee639fcfcf1e8f6efa (diff)
downloadgitea-0081cd8dfe34bcd9182ccebb406000c17dcb8025.tar.gz
gitea-0081cd8dfe34bcd9182ccebb406000c17dcb8025.zip
Add mssql migration tests (#6852)
Diffstat (limited to 'integrations/migration-test')
-rw-r--r--integrations/migration-test/gitea-v1.5.3.mssql.sql.gzbin0 -> 12747 bytes
-rw-r--r--integrations/migration-test/gitea-v1.6.4.mssql.sql.gzbin0 -> 13275 bytes
-rw-r--r--integrations/migration-test/gitea-v1.7.0.mssql.sql.gzbin0 -> 13385 bytes
-rw-r--r--integrations/migration-test/migration_test.go14
4 files changed, 7 insertions, 7 deletions
diff --git a/integrations/migration-test/gitea-v1.5.3.mssql.sql.gz b/integrations/migration-test/gitea-v1.5.3.mssql.sql.gz
new file mode 100644
index 0000000000..90c1674066
--- /dev/null
+++ b/integrations/migration-test/gitea-v1.5.3.mssql.sql.gz
Binary files differ
diff --git a/integrations/migration-test/gitea-v1.6.4.mssql.sql.gz b/integrations/migration-test/gitea-v1.6.4.mssql.sql.gz
new file mode 100644
index 0000000000..1f43e2e643
--- /dev/null
+++ b/integrations/migration-test/gitea-v1.6.4.mssql.sql.gz
Binary files differ
diff --git a/integrations/migration-test/gitea-v1.7.0.mssql.sql.gz b/integrations/migration-test/gitea-v1.7.0.mssql.sql.gz
new file mode 100644
index 0000000000..87499d2ac8
--- /dev/null
+++ b/integrations/migration-test/gitea-v1.7.0.mssql.sql.gz
Binary files differ
diff --git a/integrations/migration-test/migration_test.go b/integrations/migration-test/migration_test.go
index fafe0fe225..f168424865 100644
--- a/integrations/migration-test/migration_test.go
+++ b/integrations/migration-test/migration_test.go
@@ -13,6 +13,7 @@ import (
"path"
"regexp"
"sort"
+ "strings"
"testing"
"code.gitea.io/gitea/integrations"
@@ -120,8 +121,7 @@ func readSQLFromFile(version string) (string, error) {
if err != nil {
return "", err
}
-
- return string(bytes), nil
+ return string(base.RemoveBOMIfPresent(bytes)), nil
}
func restoreOldDB(t *testing.T, version string) bool {
@@ -199,11 +199,11 @@ func restoreOldDB(t *testing.T, version string) bool {
_, err = db.Exec("DROP DATABASE IF EXISTS gitea")
assert.NoError(t, err)
- _, err = db.Exec("CREATE DATABASE gitea")
- assert.NoError(t, err)
-
- _, err = db.Exec(data)
- assert.NoError(t, err)
+ statements := strings.Split(data, "\nGO\n")
+ for _, statement := range statements {
+ _, err = db.Exec(statement)
+ assert.NoError(t, err, "Failure whilst running: %s\nError: %v", statement, err)
+ }
db.Close()
}
return true