Skip to content

Automatically fetch PG* env vars from GDK

Jacob Vosmaer requested to merge jv-gdk-pg-env into master

We have tests in the test suite that depend on Postgres. If you want to run them locally you need to pass -tags postgres to go test. Then, they fail unless PGHOST and PGPORT are set.

This MR adds a function to the test setup that tries to automatically fetch PGHOST and PGPORT from gitlab-development-kit (GDK). That way, as long as you are using GDK, you won't have to worry about configuring your Gitaly tests to connect to Postgres.

After this MR, the following should work:

gdk start postgresql # or just 'gdk start'
go test ./internal/praefect/datastore/glsql -tags postgres
Edited by GitLab Release Tools Bot

Merge request reports