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
6d80e6a8
Commit
6d80e6a8
authored
Jun 16, 2021
by
Mike Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix too many redirects during Geo check task
Changelog: fixed EE: true
parent
304aff34
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
ee/lib/system_check/geo/http_connection_check.rb
ee/lib/system_check/geo/http_connection_check.rb
+1
-1
ee/spec/lib/system_check/geo/http_connection_check_spec.rb
ee/spec/lib/system_check/geo/http_connection_check_spec.rb
+35
-0
No files found.
ee/lib/system_check/geo/http_connection_check.rb
View file @
6d80e6a8
...
...
@@ -33,7 +33,7 @@ module SystemCheck
private
def
check_gitlab_geo_node
(
node
)
response
=
Gitlab
::
HTTP
.
get
(
node
.
internal_uri
,
allow_local_requests:
true
)
response
=
Gitlab
::
HTTP
.
get
(
node
.
internal_uri
,
allow_local_requests:
true
,
limit:
10
)
if
response
.
code_type
==
Net
::
HTTPOK
$stdout
.
puts
'yes'
.
color
(
:green
)
...
...
ee/spec/lib/system_check/geo/http_connection_check_spec.rb
View file @
6d80e6a8
...
...
@@ -39,6 +39,41 @@ RSpec.describe SystemCheck::Geo::HttpConnectionCheck do
end
end
context
'redirects'
do
def
stub_many_requests
(
num_redirects
)
url
=
primary_node
.
internal_uri
location
=
"https://example.com"
num_redirects
.
times
do
|
index
|
next_url
=
"
#{
location
}
/
#{
index
}
"
stub_request
(
http_method
,
url
).
to_return
(
status:
301
,
headers:
{
'Location'
=>
next_url
})
url
=
next_url
end
stub_request
(
http_method
,
url
).
to_return
(
status:
200
,
body:
""
,
headers:
{})
end
context
'connection succeeds after 9 redirects'
do
it
'puts yes'
do
stub_many_requests
(
9
)
expect
do
subject
.
multi_check
end
.
to
output
(
"
\n
* Can connect to the primary node ... yes
\n
"
).
to_stdout
end
end
context
'connection would succeed after 10 redirects'
do
it
'puts no'
do
stub_many_requests
(
10
)
expect
do
subject
.
multi_check
end
.
to
output
(
"
\n
* Can connect to the primary node ... no
\n
Reason:
\n
Gitlab::HTTP::RedirectionTooDeep
\n
"
).
to_stdout
end
end
end
context
'connection errored'
do
it
'puts no if check errored'
do
stub_request
(
http_method
,
primary_node
.
internal_uri
).
to_return
(
status:
400
,
body:
""
,
headers:
{})
...
...
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