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>
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
0361e8b97e
Коммит
5f7ca55b13
@@ -7,6 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/mattermost/mattermost-server/v5/store/storetest"
|
||||||
"github.com/mattermost/mattermost-server/v5/testlib"
|
"github.com/mattermost/mattermost-server/v5/testlib"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@@ -15,6 +16,7 @@ import (
|
|||||||
func TestMigrateDatabaseToFile(t *testing.T) {
|
func TestMigrateDatabaseToFile(t *testing.T) {
|
||||||
helper := testlib.NewMainHelper()
|
helper := testlib.NewMainHelper()
|
||||||
sqlSettings := helper.GetSqlSettings()
|
sqlSettings := helper.GetSqlSettings()
|
||||||
|
defer storetest.CleanupSqlSettings(sqlSettings)
|
||||||
sqlDSN := fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource)
|
sqlDSN := fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource)
|
||||||
fileDSN := "config.json"
|
fileDSN := "config.json"
|
||||||
files := []string{"IdpCertificateFile", "PublicCertificateFile", "PrivateKeyFile"}
|
files := []string{"IdpCertificateFile", "PublicCertificateFile", "PrivateKeyFile"}
|
||||||
@@ -53,6 +55,7 @@ func TestMigrateDatabaseToFile(t *testing.T) {
|
|||||||
func TestMigrateFileToDatabaseWhenFilePathIsNotSpecified(t *testing.T) {
|
func TestMigrateFileToDatabaseWhenFilePathIsNotSpecified(t *testing.T) {
|
||||||
helper := testlib.NewMainHelper()
|
helper := testlib.NewMainHelper()
|
||||||
sqlSettings := helper.GetSqlSettings()
|
sqlSettings := helper.GetSqlSettings()
|
||||||
|
defer storetest.CleanupSqlSettings(sqlSettings)
|
||||||
sqlDSN := fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource)
|
sqlDSN := fmt.Sprintf("%s://%s", *sqlSettings.DriverName, *sqlSettings.DataSource)
|
||||||
fileDSN := "config.json"
|
fileDSN := "config.json"
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,9 @@ func tearDownStores() {
|
|||||||
if st.Store != nil {
|
if st.Store != nil {
|
||||||
st.Store.Close()
|
st.Store.Close()
|
||||||
}
|
}
|
||||||
|
if st.SqlSettings != nil {
|
||||||
|
storetest.CleanupSqlSettings(st.SqlSettings)
|
||||||
|
}
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ func tearDownStores() {
|
|||||||
if st.Store != nil {
|
if st.Store != nil {
|
||||||
st.Store.Close()
|
st.Store.Close()
|
||||||
}
|
}
|
||||||
|
if st.SqlSettings != nil {
|
||||||
|
storetest.CleanupSqlSettings(st.SqlSettings)
|
||||||
|
}
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user