Commit 7c415ed9 authored by Imre Farkas's avatar Imre Farkas

Merge branch 'ignore-geo-check-license-check-on-secondaries' into 'master'

Ignore rake task license check on geo secondaries

See merge request gitlab-org/gitlab!42920
parents d6e91e24 edf8999a
---
title: Ignore rake task license check on geo secondaries
merge_request: 42920
author:
type: fixed
......@@ -6,7 +6,21 @@ module SystemCheck
set_name 'GitLab Geo is available'
def check?
Gitlab::Geo.license_allows?
return true unless Gitlab::Geo.enabled?
Gitlab::Geo.primary? ? Gitlab::Geo.license_allows? : true
end
def self.check_pass
if Gitlab::Geo.primary? && !Gitlab::Geo.enabled?
return 'License supports Geo, but Geo is not enabled' if Gitlab::Geo.license_allows?
return 'License does not support Geo, and Geo is not enabled'
elsif Gitlab::Geo.enabled? && !Gitlab::Geo.license_allows?
return 'License only required on a primary site'
end
""
end
def show_error
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe SystemCheck::Geo::LicenseCheck do
describe '#check?' do
using RSpec::Parameterized::TableSyntax
where(:primary, :geo_enabled, :license_allows, :check_result, :pass_message) do
true | true | true | true | ''
true | true | false | false | ''
true | false | true | true | 'License supports Geo, but Geo is not enabled'
true | false | false | true | 'License does not support Geo, and Geo is not enabled'
false | true | true | true | ''
false | true | false | true | 'License only required on a primary site'
false | false | true | true | ''
false | false | false | true | ''
end
with_them do
before do
allow(Gitlab::Geo).to receive(:primary?).and_return(primary)
allow(Gitlab::Geo).to receive(:enabled?).and_return(geo_enabled)
allow(Gitlab::Geo).to receive(:license_allows?).and_return(license_allows)
end
it 'checks the license' do
expect(subject.check?).to eq(check_result)
expect(described_class.check_pass).to eq(pass_message) if check_result
end
end
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