diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /spec/support/helpers/gitaly_setup.rb | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/support/helpers/gitaly_setup.rb')
-rw-r--r-- | spec/support/helpers/gitaly_setup.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/support/helpers/gitaly_setup.rb b/spec/support/helpers/gitaly_setup.rb index 56993fc27b7..278dc79e1d0 100644 --- a/spec/support/helpers/gitaly_setup.rb +++ b/spec/support/helpers/gitaly_setup.rb @@ -12,6 +12,8 @@ require 'logger' require 'fileutils' require 'bundler' +require_relative '../../../lib/gitlab/utils' + module GitalySetup extend self @@ -139,7 +141,7 @@ module GitalySetup end def start_praefect - if ENV['GITALY_PRAEFECT_WITH_DB'] + if praefect_with_db? LOGGER.debug 'Starting Praefect with database election strategy' start(:praefect, File.join(tmp_tests_gitaly_dir, 'praefect-db.config.toml')) else @@ -290,7 +292,7 @@ module GitalySetup # In CI we need to pre-generate both config files. # For local testing we'll create the correct file on-demand. - if ENV['CI'] || ENV['GITALY_PRAEFECT_WITH_DB'].nil? + if ENV['CI'] || !praefect_with_db? Gitlab::SetupHelper::Praefect.create_configuration( gitaly_dir, { 'praefect' => repos_path }, @@ -298,7 +300,7 @@ module GitalySetup ) end - if ENV['CI'] || ENV['GITALY_PRAEFECT_WITH_DB'] + if ENV['CI'] || praefect_with_db? Gitlab::SetupHelper::Praefect.create_configuration( gitaly_dir, { 'praefect' => repos_path }, @@ -319,7 +321,7 @@ module GitalySetup end def setup_praefect - return unless ENV['GITALY_PRAEFECT_WITH_DB'] + return unless praefect_with_db? migrate_cmd = service_cmd(:praefect, File.join(tmp_tests_gitaly_dir, 'praefect-db.config.toml')) + ['sql-migrate'] system(env, *migrate_cmd, [:out, :err] => 'log/praefect-test.log') @@ -396,4 +398,8 @@ module GitalySetup def praefect_binary File.join(tmp_tests_gitaly_dir, "_build", "bin", "praefect") end + + def praefect_with_db? + Gitlab::Utils.to_boolean(ENV['GITALY_PRAEFECT_WITH_DB'], default: false) + end end |