MM-21520: Remove temporary databases after tests run (#13572)

* MM-21520: Remove temorary databases after tests run

* accidental test name change

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Patryk Pomykalski
2020-01-13 16:54:07 +01:00
committed by Jesús Espino
parent 0361e8b97e
commit 5f7ca55b13
3 changed files with 9 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import (
"fmt"
"testing"
"github.com/mattermost/mattermost-server/v5/store/storetest"
"github.com/mattermost/mattermost-server/v5/testlib"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -15,6 +16,7 @@ import (
func TestMigrateDatabaseToFile(t *testing.T) {
helper := testlib.NewMainHelper()
sqlSettings := helper.GetSqlSettings()
defer storetest.CleanupSqlSettings(sqlSettings)
sqlDSN := fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource)
fileDSN := "config.json"
files := []string{"IdpCertificateFile", "PublicCertificateFile", "PrivateKeyFile"}
@@ -53,6 +55,7 @@ func TestMigrateDatabaseToFile(t *testing.T) {
func TestMigrateFileToDatabaseWhenFilePathIsNotSpecified(t *testing.T) {
helper := testlib.NewMainHelper()
sqlSettings := helper.GetSqlSettings()
defer storetest.CleanupSqlSettings(sqlSettings)
sqlDSN := fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource)
fileDSN := "config.json"

View File

@@ -91,6 +91,9 @@ func tearDownStores() {
if st.Store != nil {
st.Store.Close()
}
if st.SqlSettings != nil {
storetest.CleanupSqlSettings(st.SqlSettings)
}
wg.Done()
}()
}

View File

@@ -90,6 +90,9 @@ func tearDownStores() {
if st.Store != nil {
st.Store.Close()
}
if st.SqlSettings != nil {
storetest.CleanupSqlSettings(st.SqlSettings)
}
wg.Done()
}()
}