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
7b51049d
Commit
7b51049d
authored
Mar 20, 2018
by
Gabriel Mazetto
Committed by
Nick Thomas
Mar 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Execute FDW SystemChecks only in Geo Secondary node
parent
3551d6a3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
6 deletions
+92
-6
ee/lib/system_check/geo/fdw_enabled_check.rb
ee/lib/system_check/geo/fdw_enabled_check.rb
+2
-2
ee/lib/system_check/geo/fdw_schema_up_to_date_check.rb
ee/lib/system_check/geo/fdw_schema_up_to_date_check.rb
+6
-4
ee/spec/lib/system_check/geo/fdw_enabled_check_spec.rb
ee/spec/lib/system_check/geo/fdw_enabled_check_spec.rb
+36
-0
ee/spec/lib/system_check/geo/fdw_schema_up_to_date_check_spec.rb
.../lib/system_check/geo/fdw_schema_up_to_date_check_spec.rb
+44
-0
spec/spec_helper.rb
spec/spec_helper.rb
+4
-0
No files found.
ee/lib/system_check/geo/fdw_enabled_check.rb
View file @
7b51049d
...
...
@@ -2,10 +2,10 @@ module SystemCheck
module
Geo
class
FdwEnabledCheck
<
SystemCheck
::
BaseCheck
set_name
'GitLab Geo tracking database is configured to use Foreign Data Wrapper?'
set_skip_reason
'
Geo is not enabled
'
set_skip_reason
'
not a secondary node
'
def
skip?
!
Gitlab
::
Geo
.
enabled
?
!
Gitlab
::
Geo
.
secondary
?
end
def
check?
...
...
ee/lib/system_check/geo/fdw_schema_up_to_date_check.rb
View file @
7b51049d
...
...
@@ -2,17 +2,19 @@ module SystemCheck
module
Geo
class
FdwSchemaUpToDateCheck
<
SystemCheck
::
BaseCheck
set_name
'GitLab Geo tracking database Foreign Data Wrapper schema is up-to-date?'
set_skip_reason
'Geo is not enabled'
NOT_SECONDARY_NODE
=
'not a secondary node'
.
freeze
FDW_NOT_CONFIGURED
=
'foreign data wrapper is not configured'
.
freeze
def
skip?
unless
Gitlab
::
Geo
.
enabled
?
self
.
skip_reason
=
'Geo is not enabled'
unless
Gitlab
::
Geo
.
secondary
?
self
.
skip_reason
=
NOT_SECONDARY_NODE
return
true
end
unless
Gitlab
::
Geo
::
Fdw
.
enabled?
self
.
skip_reason
=
'Foreign Data Wrapper is not configured'
self
.
skip_reason
=
FDW_NOT_CONFIGURED
return
true
end
...
...
ee/spec/lib/system_check/geo/fdw_enabled_check_spec.rb
0 → 100644
View file @
7b51049d
require
'spec_helper'
require
'rake_helper'
describe
SystemCheck
::
Geo
::
FdwEnabledCheck
,
:geo
do
describe
'#skip?'
do
subject
{
described_class
.
new
.
skip?
}
it
'skips when Geo is disabled'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:enabled?
)
{
false
}
is_expected
.
to
be_truthy
end
it
'skips when Geo is enabled but its a primary node'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:enabled?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
false
}
is_expected
.
to
be_truthy
end
it
'does not skip when Geo is enabled and its a secondary node'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:enabled?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
is_expected
.
to
be_falsey
end
end
describe
'#check?'
do
context
'with functional FDW environment'
,
:geo_tracking_db
do
it
'returns true'
do
expect
(
subject
.
check?
).
to
be_truthy
end
end
end
end
ee/spec/lib/system_check/geo/fdw_schema_up_to_date_check_spec.rb
0 → 100644
View file @
7b51049d
require
'spec_helper'
require
'rake_helper'
describe
SystemCheck
::
Geo
::
FdwSchemaUpToDateCheck
,
:geo
do
describe
'#skip?'
do
it
'skips when Geo is disabled'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:enabled?
)
{
false
}
expect
(
subject
.
skip?
).
to
be_truthy
expect
(
subject
.
skip_reason
).
to
eq
(
'not a secondary node'
)
end
it
'skips when Geo is enabled but its a primary node'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:enabled?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
false
}
expect
(
subject
.
skip?
).
to
be_truthy
expect
(
subject
.
skip_reason
).
to
eq
(
'not a secondary node'
)
end
it
'skips when FDW is disabled'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:enabled?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
allow
(
Gitlab
::
Geo
::
Fdw
).
to
receive
(
:enabled?
)
{
false
}
expect
(
subject
.
skip?
).
to
be_truthy
expect
(
subject
.
skip_reason
).
to
eq
(
'foreign data wrapper is not configured'
)
end
it
'does not skip when Geo is enabled, its a secondary node and FDW is enabled'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:enabled?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
allow
(
Gitlab
::
Geo
::
Fdw
).
to
receive
(
:enabled?
)
{
true
}
expect
(
subject
.
skip?
).
to
be_falsey
end
end
context
'with functional FDW environment'
,
:geo_tracking_db
do
it
'returns true'
do
expect
(
subject
.
check?
).
to
be_truthy
end
end
end
spec/spec_helper.rb
View file @
7b51049d
...
...
@@ -200,6 +200,10 @@ RSpec.configure do |config|
example
.
run
if
Gitlab
::
Database
.
postgresql?
end
config
.
around
(
:each
,
:geo_tracking_db
)
do
|
example
|
example
.
run
if
Gitlab
::
Geo
.
geo_database_configured?
end
config
.
around
(
:each
,
:postgresql
)
do
|
example
|
example
.
run
if
Gitlab
::
Database
.
postgresql?
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