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
44543aef
Commit
44543aef
authored
Jan 13, 2021
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add License subscription_id to usage ping
parent
c5f3664a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
1 deletion
+24
-1
ee/app/models/license.rb
ee/app/models/license.rb
+5
-0
ee/changelogs/unreleased/297512-add-license-subscription_id-to-usage-ping.yml
...ased/297512-add-license-subscription_id-to-usage-ping.yml
+5
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+1
-0
ee/spec/factories/licenses.rb
ee/spec/factories/licenses.rb
+2
-1
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+2
-0
ee/spec/models/license_spec.rb
ee/spec/models/license_spec.rb
+9
-0
No files found.
ee/app/models/license.rb
View file @
44543aef
...
...
@@ -388,6 +388,11 @@ class License < ApplicationRecord
restricted_attr
(
:add_ons
,
{})
end
# License zuora_subscription_id
def
subscription_id
restricted_attr
(
:subscription_id
)
end
def
features_from_add_ons
add_ons
.
map
{
|
name
,
count
|
FEATURES_FOR_ADD_ONS
[
name
]
if
count
.
to_i
>
0
}.
compact
end
...
...
ee/changelogs/unreleased/297512-add-license-subscription_id-to-usage-ping.yml
0 → 100644
View file @
44543aef
---
title
:
Add License subscription_id to Usage Ping
merge_request
:
51601
author
:
type
:
added
ee/lib/ee/gitlab/usage_data.rb
View file @
44543aef
...
...
@@ -102,6 +102,7 @@ module EE
usage_data
[
:license_plan
]
=
license
.
plan
usage_data
[
:license_add_ons
]
=
license
.
add_ons
usage_data
[
:license_trial
]
=
license
.
trial?
usage_data
[
:license_subscription_id
]
=
alt_usage_data
(
fallback:
nil
)
{
license
.
subscription_id
}
end
usage_data
...
...
ee/spec/factories/licenses.rb
View file @
44543aef
...
...
@@ -35,7 +35,8 @@ FactoryBot.define do
'GitLab_FileLocks'
=>
1
,
'GitLab_Auditor_User'
=>
1
},
plan:
plan
plan:
plan
,
subscription_id:
'0000'
}
end
end
...
...
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
44543aef
...
...
@@ -72,6 +72,7 @@ RSpec.describe Gitlab::UsageData do
license_starts_at
license_user_count
license_trial
license_subscription_id
licensee
license_md5
license_id
...
...
@@ -189,6 +190,7 @@ RSpec.describe Gitlab::UsageData do
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
[
:license_subscription_id
]).
to
eq
(
license
.
subscription_id
)
end
end
...
...
ee/spec/models/license_spec.rb
View file @
44543aef
...
...
@@ -816,6 +816,15 @@ RSpec.describe License do
end
end
describe
'#subscription_id'
do
it
'has correct subscription_id'
do
gl_license
=
build
(
:gitlab_license
,
restrictions:
{
subscription_id:
"1111"
})
license
=
build
(
:license
,
data:
gl_license
.
export
)
expect
(
license
.
subscription_id
).
to
eq
(
"1111"
)
end
end
describe
'#daily_billable_users_count'
do
before_all
do
create
(
:group_member
)
...
...
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