Commit 386a140d authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'show-correct-edition-for-ee-free' into 'master'

Show correct edition for EE free

Closes gitlab-ce#41092

See merge request gitlab-org/gitlab-ee!3894
parents 02aa5f15 0666261e
---
title: Record EE instances without a license correctly in usage ping
merge_request:
author:
type: fixed
......@@ -30,8 +30,9 @@ module Gitlab
license = ::License.current
usage_data[:edition] = license_edition(license)
if license
usage_data[:edition] = license_edition(license.plan)
usage_data[:license_md5] = license.md5
usage_data[:historical_max_users] = ::HistoricalData.max_historical_user_count
usage_data[:licensee] = license.licensee
......@@ -40,6 +41,7 @@ module Gitlab
usage_data[:license_expires_at] = license.expires_at
usage_data[:license_plan] = license.plan
usage_data[:license_add_ons] = license.add_ons
usage_data[:license_trial] = license.trial?
end
usage_data
......@@ -138,8 +140,10 @@ module Gitlab
}
end
def license_edition(plan)
case plan
def license_edition(license)
return 'EE Free' unless license
case license.plan
when 'ultimate'
'EEU'
when 'premium'
......
......@@ -27,6 +27,7 @@ describe Gitlab::UsageData do
license_expires_at
license_starts_at
license_user_count
license_trial
licensee
license_md5
recorded_at
......@@ -167,6 +168,7 @@ describe Gitlab::UsageData do
expect(subject[:license_starts_at]).to eq(license.starts_at)
expect(subject[:license_expires_at]).to eq(license.expires_at)
expect(subject[:license_add_ons]).to eq(license.add_ons)
expect(subject[:license_trial]).to eq(license.trial?)
expect(subject[:recorded_at]).to be_a(Time)
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