Remove FDW schema up-to-date check

Since Gitlab 13.2 we don't rely on FDW
parent b4665a80
# frozen_string_literal: true
module SystemCheck
module Geo
class FdwSchemaUpToDateCheck < SystemCheck::BaseCheck
set_name 'GitLab Geo tracking database Foreign Data Wrapper schema is up-to-date?'
NOT_SECONDARY_NODE = 'not a secondary node'.freeze
FDW_NOT_CONFIGURED = 'foreign data wrapper is not configured'.freeze
def skip?
unless Gitlab::Geo.secondary?
self.skip_reason = NOT_SECONDARY_NODE
return true
end
unless Gitlab::Geo::Fdw.enabled?
self.skip_reason = FDW_NOT_CONFIGURED
return true
end
false
end
def check?
Gitlab::Geo::Fdw.foreign_tables_up_to_date?
end
def show_error
try_fixing_it(
'Run the following command to refresh the FDW schema:',
'gitlab-rake geo:db:refresh_foreign_tables'
)
for_more_information('doc/administration/geo/replication/troubleshooting.md#geo-database-has-an-outdated-fdw-remote-schema-error')
end
end
end
end
...@@ -37,7 +37,6 @@ module SystemCheck ...@@ -37,7 +37,6 @@ module SystemCheck
SystemCheck::Geo::DatabaseReplicationEnabledCheck, SystemCheck::Geo::DatabaseReplicationEnabledCheck,
SystemCheck::Geo::DatabaseReplicationWorkingCheck, SystemCheck::Geo::DatabaseReplicationWorkingCheck,
SystemCheck::Geo::FdwEnabledCheck, SystemCheck::Geo::FdwEnabledCheck,
SystemCheck::Geo::FdwSchemaUpToDateCheck,
SystemCheck::Geo::HttpConnectionCheck SystemCheck::Geo::HttpConnectionCheck
] + common_checks ] + common_checks
end end
......
# frozen_string_literal: true
require 'spec_helper'
require 'rake_helper'
RSpec.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_fdw do
it 'returns true' do
expect(subject.check?).to be_truthy
end
end
end
...@@ -26,7 +26,6 @@ RSpec.describe SystemCheck::RakeTask::GeoTask do ...@@ -26,7 +26,6 @@ RSpec.describe SystemCheck::RakeTask::GeoTask do
SystemCheck::Geo::DatabaseReplicationEnabledCheck, SystemCheck::Geo::DatabaseReplicationEnabledCheck,
SystemCheck::Geo::DatabaseReplicationWorkingCheck, SystemCheck::Geo::DatabaseReplicationWorkingCheck,
SystemCheck::Geo::FdwEnabledCheck, SystemCheck::Geo::FdwEnabledCheck,
SystemCheck::Geo::FdwSchemaUpToDateCheck,
SystemCheck::Geo::HttpConnectionCheck SystemCheck::Geo::HttpConnectionCheck
] + common_checks ] + common_checks
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment