From bc77c38787f3475f45014c2192e8fe41e5e422a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9my=20Coutable?= <remy@rymai.me>
Date: Tue, 13 Apr 2021 17:50:49 +0200
Subject: [PATCH] Rename GitalyTest to GitalySetup and move it to the 'spec'
 folder
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This makes sure unit and integration tests run when this file is
touched.

Signed-off-by: Rémy Coutable <remy@rymai.me>
---
 scripts/gitaly-test-build                              |  4 ++--
 scripts/gitaly-test-spawn                              |  4 ++--
 .../support/helpers/gitaly_setup.rb                    | 10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)
 rename scripts/gitaly_test.rb => spec/support/helpers/gitaly_setup.rb (94%)

diff --git a/scripts/gitaly-test-build b/scripts/gitaly-test-build
index 849c08df52750..d6b818595f0ea 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 7cb9ea803f8f6..e7e25a217b281 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 b7ea9cd628e09..d28ea62b6fa75 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
-- 
GitLab