-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent quota updates or assignment with finite log rates (#2948)
* Prevent org and space quota log rate limit changes - If an existing deployment is upgraded to gain log rate limiting support then existing application processes will default to -1 (unlimited). - If an org or space quota is subsequently updated to include a finite log rate limit then processes in the affected orgs or spaces will be unable to restart without having their log rate limit changed. - Block org and space quota finite log rate limit updates until processes under the affected orgs or spaces have been updated with a finite log rate limit. Specify the names of the first two orgs or spaces and a total count in the error. - Block assignment of org or space quotas with finite log rate limits to orgs or spaces that contain processes with unlimited log rate limits. * Prevent assignment of org and space quotas (v2) Block assignment of org or space quotas via the v2 endpoint if the quota has a finite log rate where the org or space contains processes that have unlimited log rate limits. Co-authored-by: Carson Long <lcarson@vmware.com>
- Loading branch information
Showing
15 changed files
with
387 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe 'SpaceQuotaDefinitions' do | ||
let(:user) { VCAP::CloudController::User.make } | ||
let(:org) { VCAP::CloudController::Organization.make } | ||
|
||
describe 'PUT /v2/space_quota_definitions/guid/spaces/space_guid' do | ||
context 'when the quota has a finite log rate limit and there are apps with unlimited log rates' do | ||
let(:admin_header) { headers_for(user, scopes: %w(cloud_controller.admin)) } | ||
let(:space_quota) { VCAP::CloudController::SpaceQuotaDefinition.make(organization: org, log_rate_limit: 100) } | ||
|
||
let!(:space) { VCAP::CloudController::Space.make(organization: org) } | ||
let!(:app_model) { VCAP::CloudController::AppModel.make(name: 'name1', space: space) } | ||
let!(:process_model) { VCAP::CloudController::ProcessModel.make(app: app_model, log_rate_limit: -1) } | ||
|
||
it 'returns 422' do | ||
put "/v2/space_quota_definitions/#{space_quota.guid}/spaces/#{space.guid}", nil, admin_header | ||
expect(last_response).to have_status_code(422) | ||
expect(decoded_response['error_code']).to eq('CF-UnprocessableEntity') | ||
expect(decoded_response['description']).to eq('Current usage exceeds new quota values. This space currently contains apps running with an unlimited log rate limit.') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.