diff --git a/src/github.com/matrix-org/dendrite/cmd/mediaapi-integration-tests/main.go b/src/github.com/matrix-org/dendrite/cmd/mediaapi-integration-tests/main.go index 29a79d762..f0e3b0c03 100644 --- a/src/github.com/matrix-org/dendrite/cmd/mediaapi-integration-tests/main.go +++ b/src/github.com/matrix-org/dendrite/cmd/mediaapi-integration-tests/main.go @@ -104,14 +104,17 @@ func startMediaAPI(suffix string, dynamicThumbnails bool) (*exec.Cmd, chan error proxyCmd, proxyCmdChan := test.StartProxy(proxyAddr, cfg) - cmd, cmdChan := test.StartServer( - serverType, - serverArgs, + test.InitDatabase( postgresDatabase, postgresContainerName, databases, ) + cmd, cmdChan := test.CreateBackgroundCommand( + filepath.Join(filepath.Dir(os.Args[0]), "dendrite-"+serverType+"-server"), + serverArgs, + ) + fmt.Printf("==TESTSERVER== STARTED %v -> %v : %v\n", proxyAddr, cfg.Listen.MediaAPI, dir) return cmd, cmdChan, string(cfg.Listen.MediaAPI), proxyCmd, proxyCmdChan, proxyAddr, dir } diff --git a/src/github.com/matrix-org/dendrite/cmd/syncserver-integration-tests/main.go b/src/github.com/matrix-org/dendrite/cmd/syncserver-integration-tests/main.go index 6bc59456b..b0e36c425 100644 --- a/src/github.com/matrix-org/dendrite/cmd/syncserver-integration-tests/main.go +++ b/src/github.com/matrix-org/dendrite/cmd/syncserver-integration-tests/main.go @@ -147,9 +147,7 @@ func startSyncServer() (*exec.Cmd, chan error) { testDatabaseName, } - cmd, cmdChan := test.StartServer( - "sync-api", - serverArgs, + test.InitDatabase( postgresDatabase, postgresContainerName, databases, @@ -165,6 +163,11 @@ func startSyncServer() (*exec.Cmd, chan error) { panic(err) } + cmd, cmdChan := test.CreateBackgroundCommand( + filepath.Join(filepath.Dir(os.Args[0]), "dendrite-sync-api-server"), + serverArgs, + ) + return cmd, cmdChan } diff --git a/src/github.com/matrix-org/dendrite/common/test/server.go b/src/github.com/matrix-org/dendrite/common/test/server.go index 2f089fe34..d990d4105 100644 --- a/src/github.com/matrix-org/dendrite/common/test/server.go +++ b/src/github.com/matrix-org/dendrite/common/test/server.go @@ -65,12 +65,8 @@ func CreateBackgroundCommand(command string, args []string) (*exec.Cmd, chan err return cmd, cmdChan } -// StartServer creates the database and config file needed for the server to run and -// then starts the server. The Cmd being executed is returned. A channel is also returned, -// which will have any termination errors sent down it, followed immediately by the channel being closed. -// If postgresContainerName is not an empty string, psql will be run from inside that container. If it is -// an empty string, psql will be assumed to be in PATH. -func StartServer(serverType string, serverArgs []string, postgresDatabase, postgresContainerName string, databases []string) (*exec.Cmd, chan error) { +// InitDatabase creates the database and config file needed for the server to run +func InitDatabase(postgresDatabase, postgresContainerName string, databases []string) { if len(databases) > 0 { var dbCmd string var dbArgs []string @@ -89,11 +85,6 @@ func StartServer(serverType string, serverArgs []string, postgresDatabase, postg } } } - - return CreateBackgroundCommand( - filepath.Join(filepath.Dir(os.Args[0]), "dendrite-"+serverType+"-server"), - serverArgs, - ) } // StartProxy creates a reverse proxy