mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 01:13:10 -06:00
Fix tests (hopefully)
This commit is contained in:
parent
fd7c5c69ef
commit
7372260ce6
|
|
@ -104,14 +104,17 @@ func startMediaAPI(suffix string, dynamicThumbnails bool) (*exec.Cmd, chan error
|
||||||
|
|
||||||
proxyCmd, proxyCmdChan := test.StartProxy(proxyAddr, cfg)
|
proxyCmd, proxyCmdChan := test.StartProxy(proxyAddr, cfg)
|
||||||
|
|
||||||
cmd, cmdChan := test.StartServer(
|
test.InitDatabase(
|
||||||
serverType,
|
|
||||||
serverArgs,
|
|
||||||
postgresDatabase,
|
postgresDatabase,
|
||||||
postgresContainerName,
|
postgresContainerName,
|
||||||
databases,
|
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)
|
fmt.Printf("==TESTSERVER== STARTED %v -> %v : %v\n", proxyAddr, cfg.Listen.MediaAPI, dir)
|
||||||
return cmd, cmdChan, string(cfg.Listen.MediaAPI), proxyCmd, proxyCmdChan, proxyAddr, dir
|
return cmd, cmdChan, string(cfg.Listen.MediaAPI), proxyCmd, proxyCmdChan, proxyAddr, dir
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,9 +147,7 @@ func startSyncServer() (*exec.Cmd, chan error) {
|
||||||
testDatabaseName,
|
testDatabaseName,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd, cmdChan := test.StartServer(
|
test.InitDatabase(
|
||||||
"sync-api",
|
|
||||||
serverArgs,
|
|
||||||
postgresDatabase,
|
postgresDatabase,
|
||||||
postgresContainerName,
|
postgresContainerName,
|
||||||
databases,
|
databases,
|
||||||
|
|
@ -165,6 +163,11 @@ func startSyncServer() (*exec.Cmd, chan error) {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd, cmdChan := test.CreateBackgroundCommand(
|
||||||
|
filepath.Join(filepath.Dir(os.Args[0]), "dendrite-sync-api-server"),
|
||||||
|
serverArgs,
|
||||||
|
)
|
||||||
|
|
||||||
return cmd, cmdChan
|
return cmd, cmdChan
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,12 +65,8 @@ func CreateBackgroundCommand(command string, args []string) (*exec.Cmd, chan err
|
||||||
return cmd, cmdChan
|
return cmd, cmdChan
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartServer creates the database and config file needed for the server to run and
|
// InitDatabase creates the database and config file needed for the server to run
|
||||||
// then starts the server. The Cmd being executed is returned. A channel is also returned,
|
func InitDatabase(postgresDatabase, postgresContainerName string, databases []string) {
|
||||||
// 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) {
|
|
||||||
if len(databases) > 0 {
|
if len(databases) > 0 {
|
||||||
var dbCmd string
|
var dbCmd string
|
||||||
var dbArgs []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
|
// StartProxy creates a reverse proxy
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue