Commit d91184c2 authored by Toon Claes's avatar Toon Claes

test: Only set HOME when spawning Gitaly

In the next commit we want to use GitalySetup.build_gitaly for local
testing. Prior to this change, HOME is set when calling `make`. But this
might break when Golang is installed through `asdf`.

This change moves setting HOME to where Gitaly is spawned only. We add a
little comment to explain this is done to make sure Git is not affected
by user configuration.
parent 44f0be69
......@@ -53,7 +53,6 @@ module GitalySetup
def env
{
'HOME' => expand_path('tmp/tests'),
'GEM_PATH' => Gem.path.join(':'),
'BUNDLE_INSTALL_FLAGS' => nil,
'BUNDLE_IGNORE_CONFIG' => '1',
......@@ -125,6 +124,11 @@ module GitalySetup
args = ["#{tmp_tests_gitaly_bin_dir}/#{service_binary(service)}"]
args.push("-config") if service == :praefect
args.push(config_path(service))
# Ensure user configuration does not affect Git
# Context: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/58776#note_547613780
env = self.env.merge('HOME' => nil, 'XDG_CONFIG_HOME' => nil)
pid = spawn(env, *args, [:out, :err] => "log/#{service}-test.log")
begin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment