Skip to content

Commit

Permalink
Merge pull request #3100 from ZPascal/loggregator-deprecate-v4-bindin…
Browse files Browse the repository at this point in the history
…gs-endpoint

Loggregator: add flag to deprecate v4 bindings endpoint
  • Loading branch information
philippthun authored Dec 13, 2022
2 parents 0be2140 + e0ee91d commit ec85582
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/internal/syslog_drain_urls_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def list

next_page_token = last_id + batch_size unless guid_to_drain_maps.empty?

[HTTP::OK, MultiJson.dump({ results: drain_urls, next_id: next_page_token }, pretty: true)]
[HTTP::OK, MultiJson.dump({ results: drain_urls, next_id: next_page_token, v5_available: true }, pretty: true)]
end

get '/internal/v5/syslog_drain_urls', :listv5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module VCAP::CloudController
get '/internal/v4/syslog_drain_urls', '{}'
expect(last_response).to be_successful
expect(decoded_results.count).to eq(1)
expect(decoded_v5_available).to eq(true)
expect(decoded_results).to include(
{
app_obj.guid => { 'drains' => match_array(['fish%2cfinger', 'foobar']),
Expand All @@ -34,6 +35,7 @@ module VCAP::CloudController
get '/internal/v4/syslog_drain_urls', '{}'
expect(last_response).to be_successful
expect(decoded_results.count).to eq(1)
expect(decoded_v5_available).to eq(true)
expect(decoded_results).to include(
{
app_obj.guid => { 'drains' => match_array(['fish%2cfinger', 'foobar']),
Expand All @@ -52,6 +54,7 @@ module VCAP::CloudController
get '/internal/v4/syslog_drain_urls', '{}'
expect(last_response).to be_successful
expect(decoded_results.count).to eq(1)
expect(decoded_v5_available).to eq(true)
expect(decoded_results).to include(
{
app_obj.guid => { 'drains' => match_array(['fish%2cfinger', 'foobar']),
Expand All @@ -70,6 +73,7 @@ module VCAP::CloudController
get '/internal/v4/syslog_drain_urls', '{}'
expect(last_response).to be_successful
expect(decoded_results.count).to eq(1)
expect(decoded_v5_available).to eq(true)
expect(decoded_results).to include(
{
app_obj.guid => { 'drains' => match_array(['fish%2cfinger', 'foobar']),
Expand All @@ -94,6 +98,7 @@ module VCAP::CloudController
get '/internal/v4/syslog_drain_urls', '{}'
expect(last_response).to be_successful
expect(decoded_results.count).to eq(1)
expect(decoded_v5_available).to eq(true)
expect(decoded_results).to include(
{
app_obj.guid => { 'drains' => match_array(['fish%2cfinger', 'foobar']),
Expand All @@ -116,6 +121,7 @@ module VCAP::CloudController
get '/internal/v4/syslog_drain_urls', '{}'
expect(last_response).to be_successful
expect(decoded_results.count).to eq(1)
expect(decoded_v5_available).to eq(true)
expect(decoded_results).to include(
{
app_obj.guid => { 'drains' => match_array(['fish%2cfinger', 'foobar']),
Expand All @@ -132,6 +138,7 @@ module VCAP::CloudController
it 'does not include that app' do
get '/internal/v4/syslog_drain_urls', '{}'
expect(last_response).to be_successful
expect(decoded_v5_available).to eq(true)
expect(decoded_results).not_to have_key(app_no_binding.guid)
end
end
Expand All @@ -142,6 +149,7 @@ module VCAP::CloudController
it 'does not include that app' do
get '/internal/v4/syslog_drain_urls', '{}'
expect(last_response).to be_successful
expect(decoded_v5_available).to eq(true)
expect(decoded_results).not_to have_key(app_no_drain.guid)
end
end
Expand All @@ -152,6 +160,7 @@ module VCAP::CloudController
it 'includes the app without the empty syslog_drain_urls' do
get '/internal/v4/syslog_drain_urls', '{}'
expect(last_response).to be_successful
expect(decoded_v5_available).to eq(true)
expect(decoded_results).not_to have_key(app_empty_drain.guid)
end
end
Expand All @@ -170,6 +179,7 @@ module VCAP::CloudController
it 'includes all of the syslog_drain_urls for that app' do
get '/internal/v4/syslog_drain_urls', '{}'
expect(last_response).to be_successful
expect(decoded_v5_available).to eq(true)
expect(decoded_results[app_obj.guid]['drains'].length).to eq(52)
end
end
Expand All @@ -187,6 +197,7 @@ module VCAP::CloudController
[1, 3].each do |size|
get '/internal/v4/syslog_drain_urls', { 'batch_size' => size }
expect(last_response).to be_successful
expect(decoded_v5_available).to eq(true)
expect(decoded_results.size).to eq(size)
end
end
Expand Down Expand Up @@ -235,6 +246,7 @@ module VCAP::CloudController
'next_id' => token,
}
expect(decoded_results.size).to eq(0)
expect(decoded_v5_available).to eq(true)
expect(decoded_response['next_id']).to be_nil
end

Expand All @@ -251,6 +263,7 @@ module VCAP::CloudController

saved_results = decoded_results.dup
expect(saved_results.size).to eq(2)
expect(decoded_v5_available).to eq(true)
end
end

Expand All @@ -268,6 +281,7 @@ module VCAP::CloudController

saved_results = decoded_results.dup
expect(saved_results.size).to eq(2)
expect(decoded_v5_available).to eq(true)
end
end
end
Expand Down Expand Up @@ -445,5 +459,9 @@ def decoded_results
def decoded_next_id
decoded_response.fetch('next_id')
end

def decoded_v5_available
decoded_response.fetch('v5_available')
end
end
end

0 comments on commit ec85582

Please sign in to comment.