github.com/vnforks/kid@v5.11.1+incompatible/cmd/mattermost/commands/main_test.go (about)

     1  // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package commands
     5  
     6  import (
     7  	"flag"
     8  	"os"
     9  	"testing"
    10  
    11  	"github.com/mattermost/mattermost-server/api4"
    12  	"github.com/mattermost/mattermost-server/testlib"
    13  )
    14  
    15  func TestMain(m *testing.M) {
    16  	// Command tests are run by re-invoking the test binary in question, so avoid creating
    17  	// another container when we detect same.
    18  	flag.Parse()
    19  	if filter := flag.Lookup("test.run").Value.String(); filter == "ExecCommand" {
    20  		status := m.Run()
    21  		os.Exit(status)
    22  		return
    23  	}
    24  
    25  	var options = testlib.HelperOptions{
    26  		EnableStore: true,
    27  		EnableResources: true,
    28  	}
    29  
    30  	mainHelper = testlib.NewMainHelperWithOptions(&options)
    31  	defer mainHelper.Close()
    32  
    33  	api4.UseTestStore(mainHelper.GetStore())
    34  
    35  	mainHelper.Main(m)
    36  }