Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-23 14:47:55 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-23 15:26:54 +0300
commit1eb08c1dfea7ead65c0d7a173d6a6ad2e15f2497 (patch)
tree1c6fb93f7bf48847d7024be984e9dadd8ace5498 /internal
parent84a5d6d7ee50119176396bce0e5e3fac981c5bfa (diff)
testserver: Extract database info from `gdk env`
While our Postgres-based tests know to extract information about how to connect to the database from `gdk env`, the code which sets up the Praefect proxy will only use values derived from the environment. This means that users have to manually call the likes of `eval $(gdk env)` before running "test-with-praefect". Fix this issue by unifying code paths such that the Praefect proxy setup uses the same code path as the Postgres-based tests.
Diffstat (limited to 'internal')
-rw-r--r--internal/testhelper/testserver/gitaly.go13
1 files changed, 1 insertions, 12 deletions
diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go
index da8ddd92f..0c7ed2645 100644
--- a/internal/testhelper/testserver/gitaly.go
+++ b/internal/testhelper/testserver/gitaly.go
@@ -7,7 +7,6 @@ import (
"os"
"os/exec"
"path/filepath"
- "strconv"
"testing"
"time"
@@ -73,10 +72,6 @@ func runPraefectProxy(t testing.TB, cfg config.Cfg, gitalyAddr, praefectBinPath
praefectServerSocketPath := "unix://" + testhelper.GetTemporaryGitalySocketFileName(t)
- pgport := os.Getenv("PGPORT")
- port, err := strconv.Atoi(pgport)
- require.NoError(t, err)
-
dbName := createDatabase(t)
conf := praefectconfig.Config{
@@ -85,13 +80,7 @@ func runPraefectProxy(t testing.TB, cfg config.Cfg, gitalyAddr, praefectBinPath
Auth: auth.Config{
Token: cfg.Auth.Token,
},
- DB: praefectconfig.DB{
- Host: os.Getenv("PGHOST"),
- Port: port,
- User: os.Getenv("PGUSER"),
- DBName: dbName,
- SSLMode: "disable",
- },
+ DB: glsql.GetDBConfig(t, dbName),
Failover: praefectconfig.Failover{
Enabled: true,
ElectionStrategy: praefectconfig.ElectionStrategyLocal,