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
69b2be6b
Commit
69b2be6b
authored
May 31, 2021
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename active_user to billable_users_count
for seat link sync
parent
1f48d667
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
25 deletions
+25
-25
doc/subscriptions/self_managed/index.md
doc/subscriptions/self_managed/index.md
+1
-1
ee/app/models/gitlab/seat_link_data.rb
ee/app/models/gitlab/seat_link_data.rb
+5
-5
ee/app/workers/sync_seat_link_request_worker.rb
ee/app/workers/sync_seat_link_request_worker.rb
+4
-4
ee/app/workers/sync_seat_link_worker.rb
ee/app/workers/sync_seat_link_worker.rb
+1
-1
ee/spec/features/admin/admin_settings_spec.rb
ee/spec/features/admin/admin_settings_spec.rb
+1
-1
ee/spec/models/gitlab/seat_link_data_spec.rb
ee/spec/models/gitlab/seat_link_data_spec.rb
+11
-11
ee/spec/workers/sync_seat_link_request_worker_spec.rb
ee/spec/workers/sync_seat_link_request_worker_spec.rb
+2
-2
No files found.
doc/subscriptions/self_managed/index.md
View file @
69b2be6b
...
...
@@ -256,7 +256,7 @@ VlhHNXRhVmszTkV0SVEzcEpNMWRyZEVoRU4ydHINCmRIRnFRVTlCVUVVM1pV
SlRORE4xUjFaYVJGb3JlWGM5UFZ4dUlpd2lhWFlpt2lKV00yRnNVbk5RTjJk
Sg0KU1hNMGExaE9SVGR2V2pKQlBUMWNiaUo5DQo=',
max_historical_user_count: 10,
active_users
: 6
billable_users_count
: 6
}
</code></pre>
...
...
ee/app/models/gitlab/seat_link_data.rb
View file @
69b2be6b
...
...
@@ -4,7 +4,7 @@ module Gitlab
class
SeatLinkData
include
Gitlab
::
Utils
::
StrongMemoize
attr_reader
:timestamp
,
:key
,
:max_users
,
:
active_users
attr_reader
:timestamp
,
:key
,
:max_users
,
:
billable_users_count
delegate
:to_json
,
to: :data
...
...
@@ -12,12 +12,12 @@ module Gitlab
# are preferable, like for SyncSeatLinkWorker, to determine seat link data, and in others,
# like for SyncSeatLinkRequestWorker, the params are passed because the values from when
# the job was enqueued are necessary.
def
initialize
(
timestamp:
nil
,
key:
default_key
,
max_users:
nil
,
active_users
:
nil
)
def
initialize
(
timestamp:
nil
,
key:
default_key
,
max_users:
nil
,
billable_users_count
:
nil
)
@current_time
=
Time
.
current
@timestamp
=
timestamp
||
historical_data
&
.
recorded_at
||
current_time
@key
=
key
@max_users
=
max_users
||
default_max_count
@
active_users
=
active_users
||
default_active
_count
@
billable_users_count
=
billable_users_count
||
default_billable_users
_count
end
def
sync
...
...
@@ -54,7 +54,7 @@ module Gitlab
date:
timestamp
.
to_date
.
to_s
,
license_key:
key
,
max_historical_user_count:
max_users
,
active_users:
active_users
billable_users_count:
billable_users_count
}
end
...
...
@@ -78,7 +78,7 @@ module Gitlab
end
end
def
default_
active
_count
def
default_
billable_users
_count
historical_data
&
.
active_user_count
end
end
...
...
ee/app/workers/sync_seat_link_request_worker.rb
View file @
69b2be6b
...
...
@@ -15,12 +15,12 @@ class SyncSeatLinkRequestWorker
RequestError
=
Class
.
new
(
StandardError
)
def
perform
(
timestamp
,
license_key
,
max_historical_user_count
,
active_users
)
def
perform
(
timestamp
,
license_key
,
max_historical_user_count
,
billable_users_count
)
response
=
Gitlab
::
HTTP
.
post
(
URI_PATH
,
base_uri:
EE
::
SUBSCRIPTIONS_URL
,
headers:
request_headers
,
body:
request_body
(
timestamp
,
license_key
,
max_historical_user_count
,
active_users
)
body:
request_body
(
timestamp
,
license_key
,
max_historical_user_count
,
billable_users_count
)
)
if
response
.
success?
...
...
@@ -43,12 +43,12 @@ class SyncSeatLinkRequestWorker
Gitlab
::
ErrorTracking
.
track_and_raise_for_dev_exception
(
e
)
end
def
request_body
(
timestamp
,
license_key
,
max_historical_user_count
,
active_users
)
def
request_body
(
timestamp
,
license_key
,
max_historical_user_count
,
billable_users_count
)
Gitlab
::
SeatLinkData
.
new
(
timestamp:
Time
.
zone
.
parse
(
timestamp
),
key:
license_key
,
max_users:
max_historical_user_count
,
active_users:
active_users
billable_users_count:
billable_users_count
).
to_json
end
...
...
ee/app/workers/sync_seat_link_worker.rb
View file @
69b2be6b
...
...
@@ -19,7 +19,7 @@ class SyncSeatLinkWorker # rubocop:disable Scalability/IdempotentWorker
seat_link_data
.
timestamp
.
iso8601
,
seat_link_data
.
key
,
seat_link_data
.
max_users
,
seat_link_data
.
active_users
seat_link_data
.
billable_users_count
)
end
...
...
ee/spec/features/admin/admin_settings_spec.rb
View file @
69b2be6b
...
...
@@ -283,7 +283,7 @@ RSpec.describe 'Admin updates EE-only settings' do
it
'loads seat link payload on click'
,
:js
do
page
.
within
(
'#js-seat-link-settings'
)
do
expected_payload_content
=
/(?=.*"date")(?=.*"timestamp")(?=.*"license_key")(?=.*"max_historical_user_count")(?=.*"
active_users
")/m
expected_payload_content
=
/(?=.*"date")(?=.*"timestamp")(?=.*"license_key")(?=.*"max_historical_user_count")(?=.*"
billable_users_count
")/m
expect
(
page
).
not_to
have_content
expected_payload_content
...
...
ee/spec/models/gitlab/seat_link_data_spec.rb
View file @
69b2be6b
...
...
@@ -8,14 +8,14 @@ RSpec.describe Gitlab::SeatLinkData do
timestamp:
timestamp
,
key:
key
,
max_users:
max_users
,
active_users:
active_users
billable_users_count:
billable_users_count
)
end
let_it_be
(
:timestamp
)
{
Time
.
iso8601
(
'2020-03-22T06:09:18Z'
)
}
let_it_be
(
:key
)
{
'key'
}
let_it_be
(
:max_users
)
{
11
}
let_it_be
(
:
active_users
)
{
5
}
let_it_be
(
:
billable_users_count
)
{
5
}
describe
'#initialize'
do
let_it_be
(
:utc_time
)
{
Time
.
utc
(
2020
,
3
,
12
,
12
,
00
)
}
...
...
@@ -23,14 +23,14 @@ RSpec.describe Gitlab::SeatLinkData do
let_it_be
(
:current_license
)
{
create_current_license
(
starts_at:
license_start_date
)}
let_it_be
(
:max_before_today
)
{
15
}
let_it_be
(
:yesterday_
active
_count
)
{
12
}
let_it_be
(
:today_
active
_count
)
{
20
}
let_it_be
(
:yesterday_
billable_users
_count
)
{
12
}
let_it_be
(
:today_
billable_users
_count
)
{
20
}
before_all
do
create
(
:historical_data
,
recorded_at:
license_start_date
,
active_user_count:
10
)
create
(
:historical_data
,
recorded_at:
license_start_date
+
1
.
day
,
active_user_count:
max_before_today
)
create
(
:historical_data
,
recorded_at:
utc_time
-
1
.
day
,
active_user_count:
yesterday_
active
_count
)
create
(
:historical_data
,
recorded_at:
utc_time
,
active_user_count:
today_
active
_count
)
create
(
:historical_data
,
recorded_at:
utc_time
-
1
.
day
,
active_user_count:
yesterday_
billable_users
_count
)
create
(
:historical_data
,
recorded_at:
utc_time
,
active_user_count:
today_
billable_users
_count
)
end
around
do
|
example
|
...
...
@@ -44,8 +44,8 @@ RSpec.describe Gitlab::SeatLinkData do
expect
(
subject
).
to
have_attributes
(
timestamp:
eq
(
utc_time
),
key:
eq
(
current_license
.
data
),
max_users:
eq
(
today_
active
_count
),
active_users:
eq
(
today_active
_count
)
max_users:
eq
(
today_
billable_users
_count
),
billable_users_count:
eq
(
today_billable_users
_count
)
)
end
end
...
...
@@ -56,7 +56,7 @@ RSpec.describe Gitlab::SeatLinkData do
timestamp:
eq
(
timestamp
),
key:
eq
(
key
),
max_users:
eq
(
max_users
),
active_users:
eq
(
active_users
)
billable_users_count:
eq
(
billable_users_count
)
)
end
...
...
@@ -68,7 +68,7 @@ RSpec.describe Gitlab::SeatLinkData do
timestamp:
eq
(
utc_time
-
1
.
day
),
key:
eq
(
current_license
.
data
),
max_users:
eq
(
max_before_today
),
active_users:
eq
(
yesterday_active
_count
)
billable_users_count:
eq
(
yesterday_billable_users
_count
)
)
end
end
...
...
@@ -86,7 +86,7 @@ RSpec.describe Gitlab::SeatLinkData do
date:
timestamp
.
to_date
.
iso8601
,
license_key:
key
,
max_historical_user_count:
max_users
,
active_users:
active_users
billable_users_count:
billable_users_count
}.
to_json
)
end
...
...
ee/spec/workers/sync_seat_link_request_worker_spec.rb
View file @
69b2be6b
...
...
@@ -23,7 +23,7 @@ RSpec.describe SyncSeatLinkRequestWorker, type: :worker do
date:
'2019-12-31'
,
license_key:
'123'
,
max_historical_user_count:
5
,
active_users
:
4
billable_users_count
:
4
}.
to_json
)
end
...
...
@@ -117,7 +117,7 @@ RSpec.describe SyncSeatLinkRequestWorker, type: :worker do
date:
'2020-01-01'
,
license_key:
'123'
,
max_historical_user_count:
5
,
active_users
:
4
billable_users_count
:
4
}.
to_json
)
end
...
...
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