Add store unit tests and add make target for testing store with postgres (#5925)
* Add store unit tests and add make target for testing store with postgres * Remove postgres target form test-server target * Fix audit test
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
e49f5928c5
Коммит
6b61834ab1
40
store/sql_upgrade_test.go
Обычный файл
40
store/sql_upgrade_test.go
Обычный файл
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
package store
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/platform/model"
|
||||
)
|
||||
|
||||
func TestStoreUpgrade(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
saveSchemaVersion(store.(*SqlStore), VERSION_3_0_0)
|
||||
UpgradeDatabase(store.(*SqlStore))
|
||||
|
||||
store.(*SqlStore).SchemaVersion = ""
|
||||
UpgradeDatabase(store.(*SqlStore))
|
||||
}
|
||||
|
||||
func TestSaveSchemaVersion(t *testing.T) {
|
||||
Setup()
|
||||
|
||||
saveSchemaVersion(store.(*SqlStore), VERSION_3_0_0)
|
||||
if result := <-store.System().Get(); result.Err != nil {
|
||||
t.Fatal(result.Err)
|
||||
} else {
|
||||
props := result.Data.(model.StringMap)
|
||||
if props["Version"] != VERSION_3_0_0 {
|
||||
t.Fatal("version not updated")
|
||||
}
|
||||
}
|
||||
|
||||
if store.(*SqlStore).SchemaVersion != VERSION_3_0_0 {
|
||||
t.Fatal("version not updated")
|
||||
}
|
||||
|
||||
saveSchemaVersion(store.(*SqlStore), model.CurrentVersion)
|
||||
}
|
||||
Ссылка в новой задаче
Block a user