Commit 13e251bd authored by Tyler Amos's avatar Tyler Amos

Backwards compatible active_users param

The active_users param was added to SyncSeatLinkRequestWorker without an
optional nil value, which could break existing jobs.
parent db5cd3f3
......@@ -12,7 +12,10 @@ class SyncSeatLinkRequestWorker
RequestError = Class.new(StandardError)
def perform(date, license_key, max_historical_user_count, active_users)
# active_users param is optional as it was added in a patch release for %12.9.
# The optional nil value can be removed in the next major release, %13.0, when
# it becomes mandatory.
def perform(date, license_key, max_historical_user_count, active_users = nil)
response = Gitlab::HTTP.post(
URI_PATH,
base_uri: EE::SUBSCRIPTIONS_URL,
......
---
title: Allow active_users param to be optional for SyncSeatLinkRequestWorker#perform
merge_request: 28241
author:
type: fixed
......@@ -26,6 +26,7 @@ describe SyncSeatLinkRequestWorker, type: :worker do
)
end
shared_examples 'unsuccessful request' do
context 'when the request is not successful' do
before do
stub_request(:post, seat_link_url)
......@@ -40,4 +41,31 @@ describe SyncSeatLinkRequestWorker, type: :worker do
end
end
end
it_behaves_like 'unsuccessful request'
context 'when the active_users param is not passed' do
subject do
described_class.new.perform('2020-01-01', '123', 5)
end
it 'still processes the job and sends a request with active_users set to nil' do
stub_request(:post, seat_link_url).to_return(status: 200)
subject
expect(WebMock).to have_requested(:post, seat_link_url).with(
headers: { 'Content-Type' => 'application/json' },
body: {
date: '2020-01-01',
license_key: '123',
max_historical_user_count: 5,
active_users: nil
}.to_json
)
end
it_behaves_like 'unsuccessful request'
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