github.com/mattermost/mattermost-server/v5@v5.39.3/api4/main_test.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See LICENSE.txt for license information.
     3  
     4  package api4
     5  
     6  import (
     7  	"flag"
     8  	"testing"
     9  
    10  	"github.com/mattermost/mattermost-server/v5/shared/mlog"
    11  	"github.com/mattermost/mattermost-server/v5/testlib"
    12  )
    13  
    14  var replicaFlag bool
    15  
    16  func TestMain(m *testing.M) {
    17  	if f := flag.Lookup("mysql-replica"); f == nil {
    18  		flag.BoolVar(&replicaFlag, "mysql-replica", false, "")
    19  		flag.Parse()
    20  	}
    21  
    22  	var options = testlib.HelperOptions{
    23  		EnableStore:     true,
    24  		EnableResources: true,
    25  		WithReadReplica: replicaFlag,
    26  	}
    27  
    28  	mlog.DisableZap()
    29  
    30  	mainHelper = testlib.NewMainHelperWithOptions(&options)
    31  	defer mainHelper.Close()
    32  
    33  	mainHelper.Main(m)
    34  }