github.com/space0122/mattermost-server@v5.11.1+incompatible/cmd/mattermost/commands/exec_command_test.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package commands
     5  
     6  import (
     7  	"flag"
     8  	"testing"
     9  
    10  	"github.com/stretchr/testify/require"
    11  )
    12  
    13  func TestExecCommand(t *testing.T) {
    14  	if filter := flag.Lookup("test.run").Value.String(); filter != "ExecCommand" {
    15  		t.Skip("use -run ExecCommand to execute a command via the test executable")
    16  	}
    17  	RootCmd.SetArgs(flag.Args())
    18  	require.NoError(t, RootCmd.Execute())
    19  }