summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorJacob Vosmaer (GitLab) <jacob@gitlab.com>2017-08-03 10:15:08 +0000
committerRémy Coutable <remy@rymai.me>2017-08-03 10:15:08 +0000
commit06165fa0afa843ada266b2f453eb723c8174b5bd (patch)
tree257dd7a2d839b3f0cb11e8c10dbdfe4ee45c326e /spec/support
parentbeaa0723b864371421bf4b07dbba09c5a17277e2 (diff)
downloadgitlab-ce-06165fa0afa843ada266b2f453eb723c8174b5bd.tar.gz
Remove test gitaly when older than version file
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/test_env.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index f0603dfadde..7995b5893e2 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -133,6 +133,12 @@ module TestEnv
def setup_gitaly
socket_path = Gitlab::GitalyClient.address('default').sub(/\Aunix:/, '')
gitaly_dir = File.dirname(socket_path)
+
+ if gitaly_dir_stale?(gitaly_dir)
+ puts "rm -rf #{gitaly_dir}"
+ FileUtils.rm_rf(gitaly_dir)
+ end
+
gitaly_needs_update = component_needs_update?(gitaly_dir,
Gitlab::GitalyClient.expected_server_version)
@@ -143,6 +149,11 @@ module TestEnv
start_gitaly(gitaly_dir)
end
+ def gitaly_dir_stale?(dir)
+ gitaly_executable = File.join(dir, 'gitaly')
+ !File.exist?(gitaly_executable) || (File.mtime(gitaly_executable) < File.mtime(Rails.root.join('GITALY_SERVER_VERSION')))
+ end
+
def start_gitaly(gitaly_dir)
if ENV['CI'].present?
# Gitaly has been spawned outside this process already