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
b54c4b81
Commit
b54c4b81
authored
Nov 26, 2018
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raisl5: Fix Gitlab::Database::LoadBalancing#caught_up? check
Rails 5 returns true/false instead of a string 't' or 'f'.
parent
3cd52365
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
ee/changelogs/unreleased/8583-rails5-gitlab-database-loadbalancing-caught_up-returns-state-incorrectly.yml
...ase-loadbalancing-caught_up-returns-state-incorrectly.yml
+5
-0
ee/lib/gitlab/database/load_balancing/host.rb
ee/lib/gitlab/database/load_balancing/host.rb
+1
-1
ee/spec/lib/gitlab/database/load_balancing/host_spec.rb
ee/spec/lib/gitlab/database/load_balancing/host_spec.rb
+16
-0
No files found.
ee/changelogs/unreleased/8583-rails5-gitlab-database-loadbalancing-caught_up-returns-state-incorrectly.yml
0 → 100644
View file @
b54c4b81
---
title
:
'
Raisl
5:
Fix
Gitlab::Database::LoadBalancing#caught_up?
check'
merge_request
:
8595
author
:
type
:
fixed
ee/lib/gitlab/database/load_balancing/host.rb
View file @
b54c4b81
...
...
@@ -159,7 +159,7 @@ module Gitlab
row
=
query_and_release
(
query
)
row
[
'result'
]
==
't'
::
Gitlab
::
Utils
.
to_boolean
(
row
[
'result'
])
rescue
*
CONNECTION_ERRORS
false
end
...
...
ee/spec/lib/gitlab/database/load_balancing/host_spec.rb
View file @
b54c4b81
...
...
@@ -323,6 +323,14 @@ describe Gitlab::Database::LoadBalancing::Host, :postgresql do
expect
(
host
.
caught_up?
(
'foo'
)).
to
eq
(
true
)
end
# TODO: remove rails5-only tag after removing rails4 tests
it
'returns true when a host has caught up'
,
:rails5
do
allow
(
host
).
to
receive
(
:connection
).
and_return
(
connection
)
expect
(
connection
).
to
receive
(
:select_all
).
and_return
([{
'result'
=>
true
}])
expect
(
host
.
caught_up?
(
'foo'
)).
to
eq
(
true
)
end
it
'returns false when a host has not caught up'
do
allow
(
host
).
to
receive
(
:connection
).
and_return
(
connection
)
expect
(
connection
).
to
receive
(
:select_all
).
and_return
([{
'result'
=>
'f'
}])
...
...
@@ -330,6 +338,14 @@ describe Gitlab::Database::LoadBalancing::Host, :postgresql do
expect
(
host
.
caught_up?
(
'foo'
)).
to
eq
(
false
)
end
# TODO: remove rails5-only tag after removing rails4 tests
it
'returns false when a host has not caught up'
,
:rails5
do
allow
(
host
).
to
receive
(
:connection
).
and_return
(
connection
)
expect
(
connection
).
to
receive
(
:select_all
).
and_return
([{
'result'
=>
false
}])
expect
(
host
.
caught_up?
(
'foo'
)).
to
eq
(
false
)
end
it
'returns false when the connection fails'
do
wrapped_error
=
wrapped_exception
(
ActionView
::
Template
::
Error
,
StandardError
)
...
...
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