Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4ed3d12b
Commit
4ed3d12b
authored
Jun 11, 2021
by
Dmitry Gruzd
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-zeitwerk-http' into 'master'
Rename Http to HTTP See merge request gitlab-org/gitlab!63812
parents
227082e3
577c3d87
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
17 additions
and
17 deletions
+17
-17
app/controllers/import/bulk_imports_controller.rb
app/controllers/import/bulk_imports_controller.rb
+2
-2
app/models/bulk_imports/export_status.rb
app/models/bulk_imports/export_status.rb
+1
-1
app/services/bulk_imports/file_download_service.rb
app/services/bulk_imports/file_download_service.rb
+1
-1
app/workers/bulk_imports/export_request_worker.rb
app/workers/bulk_imports/export_request_worker.rb
+1
-1
lib/bulk_imports/clients/http.rb
lib/bulk_imports/clients/http.rb
+1
-1
lib/bulk_imports/common/extractors/rest_extractor.rb
lib/bulk_imports/common/extractors/rest_extractor.rb
+1
-1
lib/bulk_imports/groups/extractors/subgroups_extractor.rb
lib/bulk_imports/groups/extractors/subgroups_extractor.rb
+1
-1
spec/controllers/import/bulk_imports_controller_spec.rb
spec/controllers/import/bulk_imports_controller_spec.rb
+2
-2
spec/lib/bulk_imports/clients/http_spec.rb
spec/lib/bulk_imports/clients/http_spec.rb
+1
-1
spec/lib/bulk_imports/common/extractors/rest_extractor_spec.rb
...lib/bulk_imports/common/extractors/rest_extractor_spec.rb
+1
-1
spec/lib/bulk_imports/groups/extractors/subgroups_extractor_spec.rb
...ulk_imports/groups/extractors/subgroups_extractor_spec.rb
+1
-1
spec/models/bulk_imports/export_status_spec.rb
spec/models/bulk_imports/export_status_spec.rb
+2
-2
spec/services/bulk_imports/file_download_service_spec.rb
spec/services/bulk_imports/file_download_service_spec.rb
+1
-1
spec/workers/bulk_imports/export_request_worker_spec.rb
spec/workers/bulk_imports/export_request_worker_spec.rb
+1
-1
No files found.
app/controllers/import/bulk_imports_controller.rb
View file @
4ed3d12b
...
@@ -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
::
H
ttp
::
ConnectionError
,
with: :bulk_import_connection_error
rescue_from
BulkImports
::
Clients
::
H
TTP
::
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
::
H
ttp
.
new
(
@client
||=
BulkImports
::
Clients
::
H
TTP
.
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
],
...
...
app/models/bulk_imports/export_status.rb
View file @
4ed3d12b
...
@@ -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
::
H
ttp
.
new
(
uri:
@configuration
.
url
,
token:
@configuration
.
access_token
)
@client
=
Clients
::
H
TTP
.
new
(
uri:
@configuration
.
url
,
token:
@configuration
.
access_token
)
end
end
def
started?
def
started?
...
...
app/services/bulk_imports/file_download_service.rb
View file @
4ed3d12b
...
@@ -52,7 +52,7 @@ module BulkImports
...
@@ -52,7 +52,7 @@ module BulkImports
end
end
def
http_client
def
http_client
@http_client
||=
BulkImports
::
Clients
::
H
ttp
.
new
(
@http_client
||=
BulkImports
::
Clients
::
H
TTP
.
new
(
uri:
configuration
.
url
,
uri:
configuration
.
url
,
token:
configuration
.
access_token
token:
configuration
.
access_token
)
)
...
...
app/workers/bulk_imports/export_request_worker.rb
View file @
4ed3d12b
...
@@ -24,7 +24,7 @@ module BulkImports
...
@@ -24,7 +24,7 @@ module BulkImports
end
end
def
http_client
(
configuration
)
def
http_client
(
configuration
)
@client
||=
Clients
::
H
ttp
.
new
(
@client
||=
Clients
::
H
TTP
.
new
(
uri:
configuration
.
url
,
uri:
configuration
.
url
,
token:
configuration
.
access_token
token:
configuration
.
access_token
)
)
...
...
lib/bulk_imports/clients/http.rb
View file @
4ed3d12b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
module
BulkImports
module
BulkImports
module
Clients
module
Clients
class
H
ttp
class
H
TTP
API_VERSION
=
'v4'
API_VERSION
=
'v4'
DEFAULT_PAGE
=
1
DEFAULT_PAGE
=
1
DEFAULT_PER_PAGE
=
30
DEFAULT_PER_PAGE
=
30
...
...
lib/bulk_imports/common/extractors/rest_extractor.rb
View file @
4ed3d12b
...
@@ -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
::
H
ttp
.
new
(
@http_client
||=
BulkImports
::
Clients
::
H
TTP
.
new
(
uri:
configuration
.
url
,
uri:
configuration
.
url
,
token:
configuration
.
access_token
,
token:
configuration
.
access_token
,
per_page:
100
per_page:
100
...
...
lib/bulk_imports/groups/extractors/subgroups_extractor.rb
View file @
4ed3d12b
...
@@ -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
::
H
ttp
.
new
(
@http_client
||=
BulkImports
::
Clients
::
H
TTP
.
new
(
uri:
configuration
.
url
,
uri:
configuration
.
url
,
token:
configuration
.
access_token
,
token:
configuration
.
access_token
,
per_page:
100
per_page:
100
...
...
spec/controllers/import/bulk_imports_controller_spec.rb
View file @
4ed3d12b
...
@@ -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
::
H
ttp
.
new
(
uri:
'http://gitlab.example'
,
token:
'token'
)
}
let
(
:client
)
{
BulkImports
::
Clients
::
H
TTP
.
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
::
H
ttp
::
ConnectionError
)
allow
(
client
).
to
receive
(
:get
).
and_raise
(
BulkImports
::
Clients
::
H
TTP
::
ConnectionError
)
end
end
it
'returns 422'
do
it
'returns 422'
do
...
...
spec/lib/bulk_imports/clients/http_spec.rb
View file @
4ed3d12b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
BulkImports
::
Clients
::
H
ttp
do
RSpec
.
describe
BulkImports
::
Clients
::
H
TTP
do
include
ImportSpecHelper
include
ImportSpecHelper
let
(
:uri
)
{
'http://gitlab.example'
}
let
(
:uri
)
{
'http://gitlab.example'
}
...
...
spec/lib/bulk_imports/common/extractors/rest_extractor_spec.rb
View file @
4ed3d12b
...
@@ -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
::
H
ttp
)
}
let
(
:http_client
)
{
instance_double
(
BulkImports
::
Clients
::
H
TTP
)
}
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'
})
}
...
...
spec/lib/bulk_imports/groups/extractors/subgroups_extractor_spec.rb
View file @
4ed3d12b
...
@@ -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
::
H
ttp
)
do
|
client
|
allow_next_instance_of
(
BulkImports
::
Clients
::
H
TTP
)
do
|
client
|
allow
(
client
).
to
receive
(
:each_page
).
and_return
(
response
)
allow
(
client
).
to
receive
(
:each_page
).
and_return
(
response
)
end
end
...
...
spec/models/bulk_imports/export_status_spec.rb
View file @
4ed3d12b
...
@@ -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
::
H
ttp
)
do
|
client
|
allow_next_instance_of
(
BulkImports
::
Clients
::
H
TTP
)
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
::
H
ttp
)
do
|
client
|
allow_next_instance_of
(
BulkImports
::
Clients
::
H
TTP
)
do
|
client
|
allow
(
client
).
to
receive
(
:get
).
and_raise
(
StandardError
,
'Error!'
)
allow
(
client
).
to
receive
(
:get
).
and_raise
(
StandardError
,
'Error!'
)
end
end
...
...
spec/services/bulk_imports/file_download_service_spec.rb
View file @
4ed3d12b
...
@@ -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
::
H
ttp
)
do
|
client
|
allow_next_instance_of
(
BulkImports
::
Clients
::
H
TTP
)
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
...
...
spec/workers/bulk_imports/export_request_worker_spec.rb
View file @
4ed3d12b
...
@@ -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
::
H
ttp
)
do
|
client
|
expect_next_instance_of
(
BulkImports
::
Clients
::
H
TTP
)
do
|
client
|
expect
(
client
).
to
receive
(
:post
).
with
(
expected
).
twice
expect
(
client
).
to
receive
(
:post
).
with
(
expected
).
twice
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment