summaryrefslogtreecommitdiff
path: root/spec/support/test_env.rb
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-06-28 21:28:02 +0000
committerRobert Speicher <robert@gitlab.com>2017-06-28 21:28:02 +0000
commit6e37e69671e775b65977ebc3d61bd200f74fdaa2 (patch)
treeb35a567d8810b061243ddf67c73b581bc89bdedf /spec/support/test_env.rb
parent9f44687a14d57fec596b9736584bf8718df75a2e (diff)
parentb4e1529e57e28dade05e307c7a3ff508c2d54f50 (diff)
downloadgitlab-ce-6e37e69671e775b65977ebc3d61bd200f74fdaa2.tar.gz
Merge branch 'shell-test-rebuild' into 'master'
Reinstall shell on the test env if it's outdated See merge request !12285
Diffstat (limited to 'spec/support/test_env.rb')
-rw-r--r--spec/support/test_env.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 1c5267c290b..32546abcad4 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -120,18 +120,21 @@ module TestEnv
end
def setup_gitlab_shell
- unless File.directory?(Gitlab.config.gitlab_shell.path)
- unless system('rake', 'gitlab:shell:install')
- raise 'Can`t clone gitlab-shell'
- end
+ shell_needs_update = component_needs_update?(Gitlab.config.gitlab_shell.path,
+ Gitlab::Shell.version_required)
+
+ unless !shell_needs_update || system('rake', 'gitlab:shell:install')
+ raise 'Can`t clone gitlab-shell'
end
end
def setup_gitaly
socket_path = Gitlab::GitalyClient.address('default').sub(/\Aunix:/, '')
gitaly_dir = File.dirname(socket_path)
+ gitaly_needs_update = component_needs_update?(gitaly_dir,
+ Gitlab::GitalyClient.expected_server_version)
- unless !gitaly_needs_update?(gitaly_dir) || system('rake', "gitlab:gitaly:install[#{gitaly_dir}]")
+ unless !gitaly_needs_update || system('rake', "gitlab:gitaly:install[#{gitaly_dir}]")
raise "Can't clone gitaly"
end
@@ -261,13 +264,13 @@ module TestEnv
end
end
- def gitaly_needs_update?(gitaly_dir)
- gitaly_version = File.read(File.join(gitaly_dir, 'VERSION')).strip
+ def component_needs_update?(component_folder, expected_version)
+ version = File.read(File.join(component_folder, '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
+ version != expected_version
rescue Errno::ENOENT
true
end