Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-10 21:08:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-10 21:08:17 +0300
commit219eead23f9feb5da9ec378c451d773aea2dfe61 (patch)
treeeec14421a05ca8eb79f3cc782abe99532bb6070c /spec/support/helpers
parent7c38405be9e79099f399aa429503ea7b463bbf5a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/helpers')
-rw-r--r--spec/support/helpers/test_env.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb
index bd945fe6409..0320f966c37 100644
--- a/spec/support/helpers/test_env.rb
+++ b/spec/support/helpers/test_env.rb
@@ -104,6 +104,9 @@ module TestEnv
setup_gitaly
+ # Feature specs are run through Workhorse
+ setup_workhorse
+
# Create repository for FactoryBot.create(:project)
setup_factory_repo
@@ -218,6 +221,52 @@ module TestEnv
ENV.fetch('GITALY_REPO_URL', nil)
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}]"
+ )
+ end
+
+ def workhorse_dir
+ @workhorse_path ||= File.join('tmp', 'tests', 'gitlab-workhorse')
+ end
+
+ def with_workhorse(workhorse_dir, host, port, upstream, &blk)
+ host = "[#{host}]" if host.include?(':')
+ listen_addr = [host, port].join(':')
+
+ workhorse_pid = spawn(
+ File.join(workhorse_dir, 'gitlab-workhorse'),
+ '-authSocket', upstream,
+ '-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', '',
+ '-logFile', 'log/workhorse-test.log',
+ '-logFormat', 'structured',
+ '-developmentMode' # to serve assets and rich error messages
+ )
+
+ begin
+ yield
+ ensure
+ Process.kill('TERM', workhorse_pid)
+ Process.wait(workhorse_pid)
+ end
+ end
+
+ def workhorse_url
+ ENV.fetch('GITLAB_WORKHORSE_URL', nil)
+ end
+
def setup_factory_repo
setup_repo(factory_repo_path, factory_repo_path_bare, factory_repo_name,
BRANCH_SHA)
@@ -347,6 +396,8 @@ module TestEnv
gitlab-test_bare
gitlab-test-fork
gitlab-test-fork_bare
+ gitlab-workhorse
+ gitlab_workhorse_secret
]
end