Commit 0cec257b authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'sh-include-redis-in-workhorse-test' into 'master'

Include Redis in Workhorse-in-test-suite integration

Closes #209245

See merge request gitlab-org/gitlab!40026
parents 968cf42f c5b96a87
---
title: Include Redis in Workhorse-in-test-suite integration
merge_request: 40026
author:
type: other
......@@ -28,6 +28,26 @@ module Gitlab
end
# rubocop:enable Rails/Output
module Workhorse
extend Gitlab::SetupHelper
class << self
def configuration_toml(dir, _)
config = { redis: { URL: redis_url } }
TomlRB.dump(config)
end
def redis_url
data = YAML.load_file(Rails.root.join('config/resque.yml'))
data.dig(Rails.env, 'url')
end
def get_config_path(dir)
File.join(dir, 'config.toml')
end
end
end
module Gitaly
extend Gitlab::SetupHelper
class << self
......
......@@ -247,8 +247,9 @@ module TestEnv
'GitLab Workhorse',
install_dir: workhorse_dir,
version: Gitlab::Workhorse.version,
task: "gitlab:workhorse:install[#{install_workhorse_args}]"
)
task: "gitlab:workhorse:install[#{install_workhorse_args}]") do
Gitlab::SetupHelper::Workhorse.create_configuration(workhorse_dir, nil)
end
end
def workhorse_dir
......@@ -259,6 +260,14 @@ module TestEnv
host = "[#{host}]" if host.include?(':')
listen_addr = [host, port].join(':')
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,
# we need to ensure the config file exists. This line can be removed
# later after a new Workhorse version is updated.
Gitlab::SetupHelper::Workhorse.create_configuration(workhorse_dir, nil) unless File.exist?(config_path)
workhorse_pid = spawn(
{ 'PATH' => "#{ENV['PATH']}:#{workhorse_dir}" },
File.join(workhorse_dir, 'gitlab-workhorse'),
......@@ -266,10 +275,7 @@ module TestEnv
'-documentRoot', Rails.root.join('public').to_s,
'-listenAddr', listen_addr,
'-secretPath', Gitlab::Workhorse.secret_path.to_s,
# TODO: Needed for workhorse + redis features.
# https://gitlab.com/gitlab-org/gitlab/-/issues/209245
#
# '-config', '',
'-config', config_path,
'-logFile', 'log/workhorse-test.log',
'-logFormat', 'structured',
'-developmentMode' # to serve assets and rich error messages
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment