From 0d56483aaccdcef5ffc3a070fbbfccf9c619d019 Mon Sep 17 00:00:00 2001 From: Aleksei Lipniagov Date: Wed, 19 May 2021 16:55:43 +0300 Subject: [PATCH] Update specs mentioning Unicorn Updates specs which are do not directly related the Unicorn-related classes which are planned to be removed. This is assumed to be a safe change, as it is spec-only, so should be easily validated via CI. Split from https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61888. --- lib/gitlab/exclusive_lease_helpers.rb | 2 +- spec/lib/gitlab/gitaly_client_spec.rb | 8 ------ spec/lib/gitlab/runtime_spec.rb | 19 ------------- spec/lib/gitlab/usage_data/topology_spec.rb | 4 +-- spec/requests/api/terraform/state_spec.rb | 18 ------------- .../api/conan_packages_shared_examples.rb | 12 --------- spec/support/unicorn.rb | 27 ------------------- 7 files changed, 3 insertions(+), 87 deletions(-) delete mode 100644 spec/support/unicorn.rb diff --git a/lib/gitlab/exclusive_lease_helpers.rb b/lib/gitlab/exclusive_lease_helpers.rb index da5b0afad38905..7cf0232fbf2de8 100644 --- a/lib/gitlab/exclusive_lease_helpers.rb +++ b/lib/gitlab/exclusive_lease_helpers.rb @@ -25,7 +25,7 @@ module ExclusiveLeaseHelpers # 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) diff --git a/spec/lib/gitlab/gitaly_client_spec.rb b/spec/lib/gitlab/gitaly_client_spec.rb index a8d42f4bccfad0..16f75691288b3e 100644 --- a/spec/lib/gitlab/gitaly_client_spec.rb +++ b/spec/lib/gitlab/gitaly_client_spec.rb @@ -33,14 +33,6 @@ def stub_repos_storages(address) 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) diff --git a/spec/lib/gitlab/runtime_spec.rb b/spec/lib/gitlab/runtime_spec.rb index 0fcb7db7d5f1a4..f51c5dd3d20450 100644 --- a/spec/lib/gitlab/runtime_spec.rb +++ b/spec/lib/gitlab/runtime_spec.rb @@ -99,25 +99,6 @@ 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') } diff --git a/spec/lib/gitlab/usage_data/topology_spec.rb b/spec/lib/gitlab/usage_data/topology_spec.rb index b8462e0290cbda..737580e349333a 100644 --- a/spec/lib/gitlab/usage_data/topology_spec.rb +++ b/spec/lib/gitlab/usage_data/topology_spec.rb @@ -95,7 +95,7 @@ }, { name: 'web', - server: 'unicorn' + server: 'puma' } ] } @@ -724,7 +724,7 @@ def receive_node_service_app_server_workers_query(result: nil) }, # instance 2 { - 'metric' => { 'instance' => 'instance2:8080', 'job' => 'gitlab-rails', 'server' => 'unicorn' }, + 'metric' => { 'instance' => 'instance2:8080', 'job' => 'gitlab-rails', 'server' => 'puma' }, 'value' => [1000, '1'] } ]) diff --git a/spec/requests/api/terraform/state_spec.rb b/spec/requests/api/terraform/state_spec.rb index 2cb3c8e9ab5714..27cdd0250486f8 100644 --- a/spec/requests/api/terraform/state_spec.rb +++ b/spec/requests/api/terraform/state_spec.rb @@ -156,15 +156,6 @@ 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 @@ 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 diff --git a/spec/support/shared_examples/requests/api/conan_packages_shared_examples.rb b/spec/support/shared_examples/requests/api/conan_packages_shared_examples.rb index c938c6432fe528..20606ae942d4b8 100644 --- a/spec/support/shared_examples/requests/api/conan_packages_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/conan_packages_shared_examples.rb @@ -294,16 +294,6 @@ 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 @@ 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 @@ 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 = { diff --git a/spec/support/unicorn.rb b/spec/support/unicorn.rb deleted file mode 100644 index 0b01fc9e26caa8..00000000000000 --- a/spec/support/unicorn.rb +++ /dev/null @@ -1,27 +0,0 @@ -# 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 -- GitLab