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
c022c44a
Commit
c022c44a
authored
Jul 26, 2018
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
raise SecondaryNotConfigured if Geo DB is not found
parent
3549ee7a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletion
+27
-1
ee/app/models/geo/tracking_base.rb
ee/app/models/geo/tracking_base.rb
+4
-1
ee/changelogs/unreleased/bw-sha-attribute-geo-fix.yml
ee/changelogs/unreleased/bw-sha-attribute-geo-fix.yml
+5
-0
ee/spec/models/geo/tracking_base_spec.rb
ee/spec/models/geo/tracking_base_spec.rb
+18
-0
No files found.
ee/app/models/geo/tracking_base.rb
View file @
c022c44a
...
...
@@ -4,6 +4,7 @@ module Geo
class
TrackingBase
<
ActiveRecord
::
Base
self
.
abstract_class
=
true
NOT_CONFIGURED_MSG
=
'Geo secondary database is not configured'
.
freeze
SecondaryNotConfigured
=
Class
.
new
(
StandardError
)
if
::
Gitlab
::
Geo
.
geo_database_configured?
...
...
@@ -12,13 +13,15 @@ module Geo
def
self
.
connection
unless
::
Gitlab
::
Geo
.
geo_database_configured?
message
=
'Geo secondary database is not configured'
message
=
NOT_CONFIGURED_MSG
message
+=
"
\n
In the GDK root, try running `make geo-setup`"
if
Rails
.
env
.
development?
raise
SecondaryNotConfigured
.
new
(
message
)
end
# Don't call super because LoadBalancing::ActiveRecordProxy will intercept it
retrieve_connection
rescue
ActiveRecord
::
NoDatabaseError
raise
SecondaryNotConfigured
.
new
(
NOT_CONFIGURED_MSG
)
end
end
end
ee/changelogs/unreleased/bw-sha-attribute-geo-fix.yml
0 → 100644
View file @
c022c44a
---
title
:
no longer fail when setting up Geo database with GDK
merge_request
:
6680
author
:
type
:
fixed
ee/spec/models/geo/tracking_base_spec.rb
0 → 100644
View file @
c022c44a
require
'spec_helper'
describe
Geo
::
TrackingBase
do
it
'raises when Geo database is not configured'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:geo_database_configured?
).
and_return
(
false
)
expect
(
described_class
).
not_to
receive
(
:retrieve_connection
)
expect
{
described_class
.
connection
}.
to
raise_error
(
Geo
::
TrackingBase
::
SecondaryNotConfigured
)
end
it
'raises when Geo database is not found'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:geo_database_configured?
).
and_return
(
true
)
allow
(
described_class
).
to
receive
(
:retrieve_connection
).
and_raise
(
ActiveRecord
::
NoDatabaseError
.
new
(
'not found'
))
expect
(
described_class
).
to
receive
(
:retrieve_connection
)
expect
{
described_class
.
connection
}.
to
raise_error
(
Geo
::
TrackingBase
::
SecondaryNotConfigured
)
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