1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-26 20:28:40 +00:00

fix dump table name error and add some test for dump database (#6394) (#6402)

This commit is contained in:
Lunny Xiao
2019-03-21 17:11:44 +08:00
committed by zeripath
parent b6fb082b78
commit c5ec66a8a3
3 changed files with 21 additions and 3 deletions

View File

@@ -6,6 +6,9 @@
package models
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
@@ -93,3 +96,14 @@ func Test_getPostgreSQLConnectionString(t *testing.T) {
assert.Equal(t, test.Output, connStr)
}
}
func TestDumpDatabase(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
dir, err := ioutil.TempDir(os.TempDir(), "dump")
assert.NoError(t, err)
for _, dbType := range supportedDatabases {
assert.NoError(t, DumpDatabase(filepath.Join(dir, dbType+".sql"), dbType))
}
}