Commit edf8999a authored by Robert Marshall's avatar Robert Marshall Committed by Imre Farkas

Ignore rake task license check on geo secondaries

- It seemed strange to be prompted for a license installation on geo
  secondary site application nodes when a license is only required on
  Geo primary site application nodes. Alter the gitlab:geo:check rake
  task to properly inform the user about the license situation.

Related https://gitlab.com/gitlab-org/gitlab-orchestrator/-/issues/30Signed-off-by: default avatarRobert Marshall <rmarshall@gitlab.com>
parent fdb87c5e
---
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