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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /scripts/gitaly_test.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'scripts/gitaly_test.rb')
-rw-r--r--scripts/gitaly_test.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/gitaly_test.rb b/scripts/gitaly_test.rb
index e6f2c9885d9..c69c4ea747b 100644
--- a/scripts/gitaly_test.rb
+++ b/scripts/gitaly_test.rb
@@ -4,6 +4,7 @@
# Please be careful when modifying this file. Your changes must work
# both for local development rspec runs, and in CI.
+require 'securerandom'
require 'socket'
module GitalyTest
@@ -11,10 +12,22 @@ module GitalyTest
File.expand_path('../tmp/tests/gitaly', __dir__)
end
+ def 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__)
+ end
+
def gemfile
File.join(tmp_tests_gitaly_dir, 'ruby', 'Gemfile')
end
+ def gitlab_shell_secret_file
+ File.join(tmp_tests_gitlab_shell_dir, '.gitlab_shell_secret')
+ end
+
def env
env_hash = {
'HOME' => File.expand_path('tmp/tests'),
@@ -70,6 +83,20 @@ module GitalyTest
pid
end
+ # Taken from Gitlab::Shell.generate_and_link_secret_token
+ def ensure_gitlab_shell_secret!
+ secret_file = rails_gitlab_shell_secret
+ shell_link = gitlab_shell_secret_file
+
+ unless File.size?(secret_file)
+ File.write(secret_file, SecureRandom.hex(16))
+ end
+
+ unless File.exist?(shell_link)
+ FileUtils.ln_s(secret_file, shell_link)
+ end
+ end
+
def check_gitaly_config!
puts "Checking gitaly-ruby Gemfile..."