From de717aef56dfaa0b9b676ce82d4b9d7abdb12428 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Thu, 15 Oct 2015 11:16:26 -0700 Subject: Marking when user ran the unit tests --- store/sql_store.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'store/sql_store.go') diff --git a/store/sql_store.go b/store/sql_store.go index 4b055e455..692ac2664 100644 --- a/store/sql_store.go +++ b/store/sql_store.go @@ -16,17 +16,18 @@ import ( "encoding/json" "errors" "fmt" - "github.com/go-gorp/gorp" - _ "github.com/go-sql-driver/mysql" - _ "github.com/lib/pq" - "github.com/mattermost/platform/model" - "github.com/mattermost/platform/utils" "io" sqltrace "log" "math/rand" "os" "strings" "time" + + "github.com/go-gorp/gorp" + _ "github.com/go-sql-driver/mysql" + _ "github.com/lib/pq" + "github.com/mattermost/platform/model" + "github.com/mattermost/platform/utils" ) type SqlStore struct { @@ -179,6 +180,17 @@ func (ss SqlStore) GetCurrentSchemaVersion() string { return version } +func (ss SqlStore) MarkSystemRanUnitTests() { + if result := <-ss.System().Get(); result.Err == nil { + props := result.Data.(model.StringMap) + unitTests := props[model.SYSTEM_RAN_UNIT_TESTS] + if len(unitTests) == 0 { + systemTests := &model.System{Name: model.SYSTEM_RAN_UNIT_TESTS, Value: "1"} + <-ss.System().Save(systemTests) + } + } +} + func (ss SqlStore) DoesTableExist(tableName string) bool { if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES { count, err := ss.GetMaster().SelectInt( -- cgit v1.2.3-1-g7c22