diff options
Diffstat (limited to 'cmd/platform/test.go')
-rw-r--r-- | cmd/platform/test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cmd/platform/test.go b/cmd/platform/test.go index 65a8528d0..cf67d6702 100644 --- a/cmd/platform/test.go +++ b/cmd/platform/test.go @@ -10,9 +10,12 @@ import ( "os/exec" "github.com/mattermost/platform/api" + "github.com/mattermost/platform/api4" "github.com/mattermost/platform/app" "github.com/mattermost/platform/utils" "github.com/spf13/cobra" + "os/signal" + "syscall" ) var testCmd = &cobra.Command{ @@ -27,9 +30,16 @@ var runWebClientTestsCmd = &cobra.Command{ RunE: webClientTestsCmdF, } +var runServerForWebClientTestsCmd = &cobra.Command{ + Use: "web_client_tests_server", + Short: "Run the server configured for running the web client tests against it", + RunE: serverForWebClientTestsCmdF, +} + func init() { testCmd.AddCommand( runWebClientTestsCmd, + runServerForWebClientTestsCmd, ) } @@ -37,6 +47,7 @@ func webClientTestsCmdF(cmd *cobra.Command, args []string) error { initDBCommandContextCobra(cmd) utils.InitTranslations(utils.Cfg.LocalizationSettings) api.InitRouter() + api4.InitApi(false) api.InitApi() setupClientTests() app.StartServer() @@ -46,6 +57,24 @@ func webClientTestsCmdF(cmd *cobra.Command, args []string) error { return nil } +func serverForWebClientTestsCmdF(cmd *cobra.Command, args []string) error { + initDBCommandContextCobra(cmd) + utils.InitTranslations(utils.Cfg.LocalizationSettings) + api.InitRouter() + api4.InitApi(false) + api.InitApi() + setupClientTests() + app.StartServer() + + c := make(chan os.Signal) + signal.Notify(c, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) + <-c + + app.StopServer() + + return nil +} + func setupClientTests() { *utils.Cfg.TeamSettings.EnableOpenServer = true *utils.Cfg.ServiceSettings.EnableCommands = false |