mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* Add store unit tests and add make target for testing store with postgres * Remove postgres target form test-server target * Fix audit test
41 lines
873 B
Go
41 lines
873 B
Go
// 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)
|
|
}
|