summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-05-23 15:27:39 -0400
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-05-24 18:17:02 -0400
commiteef12afc74cd93d3d59c2e33d562849694e9f6bb (patch)
tree8fdcd74e83b71583c5a4c57b6bc92eeb55ce31d1
parent52527be4387cb978402a330f2e4de96e586a62db (diff)
downloadgitlab-ce-32762-gitaly-should-be-recompiled-when-gitaly_server_version-changes.tar.gz
Re-download and recompile Gitaly in tests if the version changed32762-gitaly-should-be-recompiled-when-gitaly_server_version-changes
-rw-r--r--spec/support/test_env.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index b168098edea..3c000feba5d 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -123,7 +123,7 @@ module TestEnv
socket_path = Gitlab::GitalyClient.address('default').sub(/\Aunix:/, '')
gitaly_dir = File.dirname(socket_path)
- unless File.directory?(gitaly_dir) || system('rake', "gitlab:gitaly:install[#{gitaly_dir}]")
+ unless !gitaly_needs_update?(gitaly_dir) || system('rake', "gitlab:gitaly:install[#{gitaly_dir}]")
raise "Can't clone gitaly"
end
@@ -252,4 +252,15 @@ module TestEnv
cleanup && init unless reset.call
end
end
+
+ def gitaly_needs_update?(gitaly_dir)
+ gitaly_version = File.read(File.join(gitaly_dir, 'VERSION')).strip
+
+ # Notice that this will always yield true when using branch versions
+ # (`=branch_name`), but that actually makes sure the server is always based
+ # on the latest branch revision.
+ gitaly_version != Gitlab::GitalyClient.expected_server_version
+ rescue Errno::ENOENT
+ true
+ end
end