diff --git a/scripts/gitaly-test-build b/scripts/gitaly-test-build
index 849c08df527509f6d41a3b4ad48c2bf548737609..d6b818595f0ea23bdc0018dd1469d3c04a468bd5 100755
--- a/scripts/gitaly-test-build
+++ b/scripts/gitaly-test-build
@@ -3,14 +3,14 @@
 
 require 'fileutils'
 
-require_relative 'gitaly_test'
+require_relative '../spec/support/helpers/gitaly_setup'
 
 # This script assumes tmp/tests/gitaly already contains the correct
 # Gitaly version. We just have to compile it and run its 'bundle
 # install'. We have this separate script for that to avoid bundle
 # poisoning in CI. This script should only be run in CI.
 class GitalyTestBuild
-  include GitalyTest
+  include GitalySetup
 
   def run
     set_bundler_config
diff --git a/scripts/gitaly-test-spawn b/scripts/gitaly-test-spawn
index 7cb9ea803f8f6fa93150141d99454b10832051a1..e7e25a217b2811ff45d0229eea4fd582d226ccb7 100755
--- a/scripts/gitaly-test-spawn
+++ b/scripts/gitaly-test-spawn
@@ -3,10 +3,10 @@
 
 # This script is used both in CI and in local development 'rspec' runs.
 
-require_relative 'gitaly_test'
+require_relative '../spec/support/helpers/gitaly_setup'
 
 class GitalyTestSpawn
-  include GitalyTest
+  include GitalySetup
 
   def run
     set_bundler_config
diff --git a/scripts/gitaly_test.rb b/spec/support/helpers/gitaly_setup.rb
similarity index 94%
rename from scripts/gitaly_test.rb
rename to spec/support/helpers/gitaly_setup.rb
index b7ea9cd628e093df48950c8169bc7e35f7790f17..d28ea62b6fa758a6d59b741d67f78d6be4bae8fd 100644
--- a/scripts/gitaly_test.rb
+++ b/spec/support/helpers/gitaly_setup.rb
@@ -10,7 +10,7 @@
 require 'socket'
 require 'logger'
 
-module GitalyTest
+module GitalySetup
   LOGGER = begin
     default_name = ENV['CI'] ? 'DEBUG' : 'WARN'
     level_name = ENV['GITLAB_TESTING_LOG_LEVEL']&.upcase
@@ -19,15 +19,15 @@ module GitalyTest
   end
 
   def tmp_tests_gitaly_dir
-    File.expand_path('../tmp/tests/gitaly', __dir__)
+    File.expand_path('../../../tmp/tests/gitaly', __dir__)
   end
 
   def tmp_tests_gitlab_shell_dir
-    File.expand_path('../tmp/tests/gitlab-shell', __dir__)
+    File.expand_path('../../../tmp/tests/gitlab-shell', __dir__)
   end
 
   def rails_gitlab_shell_secret
-    File.expand_path('../.gitlab_shell_secret', __dir__)
+    File.expand_path('../../../.gitlab_shell_secret', __dir__)
   end
 
   def gemfile
@@ -62,7 +62,7 @@ def set_bundler_config
     system('bundle config set --local retry 3', chdir: gemfile_dir)
 
     if ENV['CI']
-      bundle_path = File.expand_path('../vendor/gitaly-ruby', __dir__)
+      bundle_path = File.expand_path('../../../vendor/gitaly-ruby', __dir__)
       system('bundle', 'config', 'set', '--local', 'path', bundle_path, chdir: gemfile_dir)
     end
   end