diff options
author | Nick Thomas <nick@gitlab.com> | 2017-12-11 17:52:07 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-12-14 16:00:04 +0000 |
commit | 4b785df27baa78b2ebe51e66de25edcb8566ab2d (patch) | |
tree | f80c1368a7a8cc42e70f6fd6978119e6f23bc906 /spec/support | |
parent | 391bb437611b91e2767384ff9852beb573c84996 (diff) | |
download | gitlab-ce-4b785df27baa78b2ebe51e66de25edcb8566ab2d.tar.gz |
Import gitlab_projects.rb from gitlab-shell
By importing this Ruby code into gitlab-rails (and gitaly-ruby), we avoid
200ms of startup time for each gitlab_projects subprocess we are eliminating.
By not having a gitlab_projects subprocess between gitlab-rails / sidekiq and
any git subprocesses (e.g. for fork_project, fetch_remote, etc, calls), we can
also manage these git processes more cleanly, and avoid sending SIGKILL to them
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/stub_env.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/spec/support/stub_env.rb b/spec/support/stub_env.rb index 19fbe572930..f621463e621 100644 --- a/spec/support/stub_env.rb +++ b/spec/support/stub_env.rb @@ -17,6 +17,7 @@ module StubENV def add_stubbed_value(key, value) allow(ENV).to receive(:[]).with(key).and_return(value) + allow(ENV).to receive(:key?).with(key).and_return(true) allow(ENV).to receive(:fetch).with(key).and_return(value) allow(ENV).to receive(:fetch).with(key, anything()) do |_, default_val| value || default_val @@ -29,6 +30,7 @@ module StubENV def init_stub allow(ENV).to receive(:[]).and_call_original + allow(ENV).to receive(:key?).and_call_original allow(ENV).to receive(:fetch).and_call_original add_stubbed_value(STUBBED_KEY, true) end |