diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/support/helpers/test_env.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/support/helpers/test_env.rb')
-rw-r--r-- | spec/support/helpers/test_env.rb | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index 4c78ca0117c..01571277a1d 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -168,6 +168,11 @@ module TestEnv version: Gitlab::GitalyClient.expected_server_version, task: "gitlab:gitaly:install[#{install_gitaly_args}]") do Gitlab::SetupHelper::Gitaly.create_configuration(gitaly_dir, { 'default' => repos_path }, force: true) + Gitlab::SetupHelper::Gitaly.create_configuration( + gitaly_dir, + { 'default' => repos_path }, force: true, + options: { gitaly_socket: "gitaly2.socket", config_filename: "gitaly2.config.toml" } + ) Gitlab::SetupHelper::Praefect.create_configuration(gitaly_dir, { 'praefect' => repos_path }, force: true) end @@ -241,15 +246,38 @@ module TestEnv end def setup_workhorse - install_workhorse_args = [workhorse_dir, workhorse_url].compact.join(',') - - component_timed_setup( - 'GitLab Workhorse', - install_dir: workhorse_dir, - version: Gitlab::Workhorse.version, - task: "gitlab:workhorse:install[#{install_workhorse_args}]") do - Gitlab::SetupHelper::Workhorse.create_configuration(workhorse_dir, nil) - end + start = Time.now + return if skip_compile_workhorse? + + puts "\n==> Setting up GitLab Workhorse..." + + FileUtils.rm_rf(workhorse_dir) + Gitlab::SetupHelper::Workhorse.compile_into(workhorse_dir) + Gitlab::SetupHelper::Workhorse.create_configuration(workhorse_dir, nil) + + File.write(workhorse_tree_file, workhorse_tree) if workhorse_source_clean? + + puts " GitLab Workhorse set up in #{Time.now - start} seconds...\n" + end + + def skip_compile_workhorse? + File.directory?(workhorse_dir) && + workhorse_source_clean? && + File.exist?(workhorse_tree_file) && + workhorse_tree == File.read(workhorse_tree_file) + end + + def workhorse_source_clean? + out = IO.popen(%w[git status --porcelain workhorse], &:read) + $?.success? && out.empty? + end + + def workhorse_tree + IO.popen(%w[git rev-parse HEAD:workhorse], &:read) + end + + def workhorse_tree_file + File.join(workhorse_dir, 'WORKHORSE_TREE') end def workhorse_dir @@ -260,7 +288,7 @@ module TestEnv host = "[#{host}]" if host.include?(':') listen_addr = [host, port].join(':') - config_path = Gitlab::SetupHelper::Workhorse.get_config_path(workhorse_dir) + config_path = Gitlab::SetupHelper::Workhorse.get_config_path(workhorse_dir, {}) # This should be set up in setup_workhorse, but since # component_needs_update? only checks that versions are consistent, |