Commit b23d40d9 authored by Matthias Käppler's avatar Matthias Käppler

Merge branch '330402-remove-unicorn-gitlab-specs' into 'master'

Remove Unicorn support: update individual specs

See merge request gitlab-org/gitlab!62107
parents e17670b9 0d56483a
......@@ -25,7 +25,7 @@ module Gitlab
# a proc that computes the sleep time given the number of preceding attempts
# (from 1 to retries - 1)
#
# Note: It's basically discouraged to use this method in a unicorn thread,
# Note: It's basically discouraged to use this method in a webserver thread,
# because this ties up all thread related resources until all `retries` are consumed.
# This could potentially eat up all connection pools.
def in_lock(key, ttl: 1.minute, retries: 10, sleep_sec: 0.01.seconds)
......
......@@ -33,14 +33,6 @@ RSpec.describe Gitlab::GitalyClient do
it { expect(subject.long_timeout).to eq(6.hours) }
end
context 'running in Unicorn' do
before do
allow(Gitlab::Runtime).to receive(:unicorn?).and_return(true)
end
it { expect(subject.long_timeout).to eq(55) }
end
context 'running in Puma' do
before do
allow(Gitlab::Runtime).to receive(:puma?).and_return(true)
......
......@@ -99,25 +99,6 @@ RSpec.describe Gitlab::Runtime do
end
end
context "unicorn" do
before do
stub_const('::Unicorn', Module.new)
stub_const('::Unicorn::HttpServer', Class.new)
stub_env('ACTION_CABLE_IN_APP', 'false')
end
it_behaves_like "valid runtime", :unicorn, 1
context "when ActionCable in-app mode is enabled" do
before do
stub_env('ACTION_CABLE_IN_APP', 'true')
stub_env('ACTION_CABLE_WORKER_POOL_SIZE', '3')
end
it_behaves_like "valid runtime", :unicorn, 4
end
end
context "sidekiq" do
let(:sidekiq_type) { double('::Sidekiq') }
......
......@@ -95,7 +95,7 @@ RSpec.describe Gitlab::UsageData::Topology do
},
{
name: 'web',
server: 'unicorn'
server: 'puma'
}
]
}
......@@ -724,7 +724,7 @@ RSpec.describe Gitlab::UsageData::Topology do
},
# instance 2
{
'metric' => { 'instance' => 'instance2:8080', 'job' => 'gitlab-rails', 'server' => 'unicorn' },
'metric' => { 'instance' => 'instance2:8080', 'job' => 'gitlab-rails', 'server' => 'puma' },
'value' => [1000, '1']
}
])
......
......@@ -156,15 +156,6 @@ RSpec.describe API::Terraform::State do
expect(response).to have_gitlab_http_status(:ok)
expect(Gitlab::Json.parse(response.body)).to be_empty
end
context 'on Unicorn', :unicorn do
it 'updates the state' do
expect { request }.to change { Terraform::State.count }.by(0)
expect(response).to have_gitlab_http_status(:ok)
expect(Gitlab::Json.parse(response.body)).to be_empty
end
end
end
context 'without body' do
......@@ -200,15 +191,6 @@ RSpec.describe API::Terraform::State do
expect(response).to have_gitlab_http_status(:ok)
expect(Gitlab::Json.parse(response.body)).to be_empty
end
context 'on Unicorn', :unicorn do
it 'creates a new state' do
expect { request }.to change { Terraform::State.count }.by(1)
expect(response).to have_gitlab_http_status(:ok)
expect(Gitlab::Json.parse(response.body)).to be_empty
end
end
end
context 'without body' do
......
......@@ -294,16 +294,6 @@ RSpec.shared_examples 'rejects invalid upload_url params' do
end
end
RSpec.shared_examples 'successful response when using Unicorn' do
context 'on Unicorn', :unicorn do
it 'returns successfully' do
subject
expect(response).to have_gitlab_http_status(:ok)
end
end
end
RSpec.shared_examples 'recipe snapshot endpoint' do
subject { get api(url), headers: headers }
......@@ -372,7 +362,6 @@ RSpec.shared_examples 'recipe upload_urls endpoint' do
it_behaves_like 'rejects invalid recipe'
it_behaves_like 'rejects invalid upload_url params'
it_behaves_like 'successful response when using Unicorn'
it 'returns a set of upload urls for the files requested' do
subject
......@@ -434,7 +423,6 @@ RSpec.shared_examples 'package upload_urls endpoint' do
it_behaves_like 'rejects invalid recipe'
it_behaves_like 'rejects invalid upload_url params'
it_behaves_like 'successful response when using Unicorn'
it 'returns a set of upload urls for the files requested' do
expected_response = {
......
# frozen_string_literal: true
REQUEST_CLASSES = [
::Grape::Request,
::Rack::Request
].freeze
def request_body_class
return ::Unicorn::TeeInput if defined?(::Unicorn)
Class.new(StringIO) do
def string
raise NotImplementedError, '#string is only valid under Puma which uses StringIO, use #read instead'
end
end
end
RSpec.configure do |config|
config.before(:each, :unicorn) do
REQUEST_CLASSES.each do |request_class|
allow_any_instance_of(request_class)
.to receive(:body).and_wrap_original do |m, *args|
request_body_class.new(m.call(*args).read)
end
end
end
end
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