Commit 4ed3d12b authored by Dmitry Gruzd's avatar Dmitry Gruzd

Merge branch 'fix-zeitwerk-http' into 'master'

Rename Http to HTTP

See merge request gitlab-org/gitlab!63812
parents 227082e3 577c3d87
...@@ -10,7 +10,7 @@ class Import::BulkImportsController < ApplicationController ...@@ -10,7 +10,7 @@ class Import::BulkImportsController < ApplicationController
POLLING_INTERVAL = 3_000 POLLING_INTERVAL = 3_000
rescue_from BulkImports::Clients::Http::ConnectionError, with: :bulk_import_connection_error rescue_from BulkImports::Clients::HTTP::ConnectionError, with: :bulk_import_connection_error
def configure def configure
session[access_token_key] = configure_params[access_token_key]&.strip session[access_token_key] = configure_params[access_token_key]&.strip
...@@ -86,7 +86,7 @@ class Import::BulkImportsController < ApplicationController ...@@ -86,7 +86,7 @@ class Import::BulkImportsController < ApplicationController
end end
def client def client
@client ||= BulkImports::Clients::Http.new( @client ||= BulkImports::Clients::HTTP.new(
uri: session[url_key], uri: session[url_key],
token: session[access_token_key], token: session[access_token_key],
per_page: params[:per_page], per_page: params[:per_page],
......
...@@ -9,7 +9,7 @@ module BulkImports ...@@ -9,7 +9,7 @@ module BulkImports
@relation = relation @relation = relation
@entity = @pipeline_tracker.entity @entity = @pipeline_tracker.entity
@configuration = @entity.bulk_import.configuration @configuration = @entity.bulk_import.configuration
@client = Clients::Http.new(uri: @configuration.url, token: @configuration.access_token) @client = Clients::HTTP.new(uri: @configuration.url, token: @configuration.access_token)
end end
def started? def started?
......
...@@ -52,7 +52,7 @@ module BulkImports ...@@ -52,7 +52,7 @@ module BulkImports
end end
def http_client def http_client
@http_client ||= BulkImports::Clients::Http.new( @http_client ||= BulkImports::Clients::HTTP.new(
uri: configuration.url, uri: configuration.url,
token: configuration.access_token token: configuration.access_token
) )
......
...@@ -24,7 +24,7 @@ module BulkImports ...@@ -24,7 +24,7 @@ module BulkImports
end end
def http_client(configuration) def http_client(configuration)
@client ||= Clients::Http.new( @client ||= Clients::HTTP.new(
uri: configuration.url, uri: configuration.url,
token: configuration.access_token token: configuration.access_token
) )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module BulkImports module BulkImports
module Clients module Clients
class Http class HTTP
API_VERSION = 'v4' API_VERSION = 'v4'
DEFAULT_PAGE = 1 DEFAULT_PAGE = 1
DEFAULT_PER_PAGE = 30 DEFAULT_PER_PAGE = 30
......
...@@ -24,7 +24,7 @@ module BulkImports ...@@ -24,7 +24,7 @@ module BulkImports
attr_reader :query attr_reader :query
def http_client(configuration) def http_client(configuration)
@http_client ||= BulkImports::Clients::Http.new( @http_client ||= BulkImports::Clients::HTTP.new(
uri: configuration.url, uri: configuration.url,
token: configuration.access_token, token: configuration.access_token,
per_page: 100 per_page: 100
......
...@@ -17,7 +17,7 @@ module BulkImports ...@@ -17,7 +17,7 @@ module BulkImports
private private
def http_client(configuration) def http_client(configuration)
@http_client ||= BulkImports::Clients::Http.new( @http_client ||= BulkImports::Clients::HTTP.new(
uri: configuration.url, uri: configuration.url,
token: configuration.access_token, token: configuration.access_token,
per_page: 100 per_page: 100
......
...@@ -51,7 +51,7 @@ RSpec.describe Import::BulkImportsController do ...@@ -51,7 +51,7 @@ RSpec.describe Import::BulkImportsController do
end end
describe 'GET status' do describe 'GET status' do
let(:client) { BulkImports::Clients::Http.new(uri: 'http://gitlab.example', token: 'token') } let(:client) { BulkImports::Clients::HTTP.new(uri: 'http://gitlab.example', token: 'token') }
describe 'serialized group data' do describe 'serialized group data' do
let(:client_response) do let(:client_response) do
...@@ -149,7 +149,7 @@ RSpec.describe Import::BulkImportsController do ...@@ -149,7 +149,7 @@ RSpec.describe Import::BulkImportsController do
context 'when connection error occurs' do context 'when connection error occurs' do
before do before do
allow(controller).to receive(:client).and_return(client) allow(controller).to receive(:client).and_return(client)
allow(client).to receive(:get).and_raise(BulkImports::Clients::Http::ConnectionError) allow(client).to receive(:get).and_raise(BulkImports::Clients::HTTP::ConnectionError)
end end
it 'returns 422' do it 'returns 422' do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe BulkImports::Clients::Http do RSpec.describe BulkImports::Clients::HTTP do
include ImportSpecHelper include ImportSpecHelper
let(:uri) { 'http://gitlab.example' } let(:uri) { 'http://gitlab.example' }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe BulkImports::Common::Extractors::RestExtractor do RSpec.describe BulkImports::Common::Extractors::RestExtractor do
let(:http_client) { instance_double(BulkImports::Clients::Http) } let(:http_client) { instance_double(BulkImports::Clients::HTTP) }
let(:options) { { query: double(to_h: { resource: nil, query: nil }) } } let(:options) { { query: double(to_h: { resource: nil, query: nil }) } }
let(:response) { double(parsed_response: { 'data' => { 'foo' => 'bar' } }, headers: { 'x-next-page' => '2' }) } let(:response) { double(parsed_response: { 'data' => { 'foo' => 'bar' } }, headers: { 'x-next-page' => '2' }) }
......
...@@ -12,7 +12,7 @@ RSpec.describe BulkImports::Groups::Extractors::SubgroupsExtractor do ...@@ -12,7 +12,7 @@ RSpec.describe BulkImports::Groups::Extractors::SubgroupsExtractor do
response = [{ 'test' => 'group' }] response = [{ 'test' => 'group' }]
context = BulkImports::Pipeline::Context.new(tracker) context = BulkImports::Pipeline::Context.new(tracker)
allow_next_instance_of(BulkImports::Clients::Http) do |client| allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
allow(client).to receive(:each_page).and_return(response) allow(client).to receive(:each_page).and_return(response)
end end
......
...@@ -16,7 +16,7 @@ RSpec.describe BulkImports::ExportStatus do ...@@ -16,7 +16,7 @@ RSpec.describe BulkImports::ExportStatus do
subject { described_class.new(tracker, relation) } subject { described_class.new(tracker, relation) }
before do before do
allow_next_instance_of(BulkImports::Clients::Http) do |client| allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
allow(client).to receive(:get).and_return(response_double) allow(client).to receive(:get).and_return(response_double)
end end
end end
...@@ -66,7 +66,7 @@ RSpec.describe BulkImports::ExportStatus do ...@@ -66,7 +66,7 @@ RSpec.describe BulkImports::ExportStatus do
context 'when something goes wrong during export status fetch' do context 'when something goes wrong during export status fetch' do
it 'returns exception class as error' do it 'returns exception class as error' do
allow_next_instance_of(BulkImports::Clients::Http) do |client| allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
allow(client).to receive(:get).and_raise(StandardError, 'Error!') allow(client).to receive(:get).and_raise(StandardError, 'Error!')
end end
......
...@@ -26,7 +26,7 @@ RSpec.describe BulkImports::FileDownloadService do ...@@ -26,7 +26,7 @@ RSpec.describe BulkImports::FileDownloadService do
subject { described_class.new(configuration: config, relative_url: '/test', dir: tmpdir, filename: filename) } subject { described_class.new(configuration: config, relative_url: '/test', dir: tmpdir, filename: filename) }
before do before do
allow_next_instance_of(BulkImports::Clients::Http) do |client| allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
allow(client).to receive(:head).and_return(response_double) allow(client).to receive(:head).and_return(response_double)
allow(client).to receive(:stream).and_yield(chunk_double) allow(client).to receive(:stream).and_yield(chunk_double)
end end
......
...@@ -19,7 +19,7 @@ RSpec.describe BulkImports::ExportRequestWorker do ...@@ -19,7 +19,7 @@ RSpec.describe BulkImports::ExportRequestWorker do
it 'requests relations export' do it 'requests relations export' do
expected = "/groups/foo%2Fbar/export_relations" expected = "/groups/foo%2Fbar/export_relations"
expect_next_instance_of(BulkImports::Clients::Http) do |client| expect_next_instance_of(BulkImports::Clients::HTTP) do |client|
expect(client).to receive(:post).with(expected).twice expect(client).to receive(:post).with(expected).twice
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