From cc6595f8485efca5f2a796e3418f43e648f6e8ad Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 8 Jun 2017 14:53:45 +0200 Subject: [PATCH] common/test/server: Clarify postgresContainerName --- .../matrix-org/dendrite/cmd/mediaapi-integration-tests/main.go | 2 +- .../dendrite/cmd/syncserver-integration-tests/main.go | 2 +- src/github.com/matrix-org/dendrite/common/test/server.go | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) 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 13c83c5de..9902f4ef8 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 @@ -37,7 +37,7 @@ var ( postgresDatabase = test.Defaulting(os.Getenv("POSTGRES_DATABASE"), "postgres") // The name of the test database to create. testDatabaseName = test.Defaulting(os.Getenv("DATABASE_NAME"), "mediaapi_test") - // Postgres docker container name (for running psql) + // Postgres docker container name (for running psql). If not set, psql must be in PATH. postgresContainerName = os.Getenv("POSTGRES_CONTAINER") // Test image to be uploaded/downloaded testJPEG = test.Defaulting(os.Getenv("TEST_JPEG_PATH"), "src/github.com/matrix-org/dendrite/cmd/mediaapi-integration-tests/totem.jpg") 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 4f1786fab..b73405583 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 @@ -43,7 +43,7 @@ var ( timeoutString = test.Defaulting(os.Getenv("TIMEOUT"), "10s") // The name of maintenance database to connect to in order to create the test database. postgresDatabase = test.Defaulting(os.Getenv("POSTGRES_DATABASE"), "postgres") - // Postgres docker container name (for running psql) + // Postgres docker container name (for running psql). If not set, psql must be in PATH. postgresContainerName = os.Getenv("POSTGRES_CONTAINER") // The name of the test database to create. testDatabaseName = test.Defaulting(os.Getenv("DATABASE_NAME"), "syncserver_test") 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 6e670d372..dca0aa94c 100644 --- a/src/github.com/matrix-org/dendrite/common/test/server.go +++ b/src/github.com/matrix-org/dendrite/common/test/server.go @@ -67,6 +67,8 @@ func CreateBackgroundCommand(command string, args []string) (*exec.Cmd, chan err // 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, suffix, configFilename, configFileContents, postgresDatabase, postgresContainerName string, databases []string) (*exec.Cmd, chan error) { if len(databases) > 0 { var dbCmd string