Skip to content

Commit 2f4b3bd

Browse files
committed
Introduce max_service_credential_bindings_per_app_service_instance
1 parent d8e001f commit 2f4b3bd

File tree

7 files changed

+4
-19
lines changed

7 files changed

+4
-19
lines changed

app/actions/service_credential_binding_app_create.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,7 @@ def event_repository
109109
end
110110

111111
def max_bindings_per_app_service_instance
112-
1
113-
# NOTE: This is hard-coded to 1 for now to preserve the old uniqueness behavior.
114-
# TODO: Once the DB migration that drops the unique constraints for service bindings has been released,
115-
# this should be switched to read from config:
116-
# VCAP::CloudController::Config.config.get(:max_service_credential_bindings_per_app_service_instance)
117-
# TODO: Also remove skips in related specs.
112+
VCAP::CloudController::Config.config.get(:max_service_credential_bindings_per_app_service_instance)
118113
end
119114

120115
def app_is_required!

config/cloud_controller.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ directories:
322322
stacks_file: config/stacks.yml
323323
newrelic_enabled: false
324324

325+
max_service_credential_bindings_per_app_service_instance: 1
325326
max_annotations_per_resource: 200
326327
max_labels_per_resource: 50
327328
max_migration_duration_in_minutes: 45

lib/cloud_controller/config_schemas/api_schema.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ class ApiSchema < VCAP::Config
410410
optional(:query_raise_on_mismatch) => bool
411411
},
412412

413+
max_service_credential_bindings_per_app_service_instance: Integer,
413414
max_labels_per_resource: Integer,
414415
max_annotations_per_resource: Integer,
415416

lib/cloud_controller/config_schemas/worker_schema.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ class WorkerSchema < VCAP::Config
221221

222222
max_manifest_service_binding_poll_duration_in_seconds: Integer,
223223

224+
max_service_credential_bindings_per_app_service_instance: Integer,
224225
max_labels_per_resource: Integer,
225226
max_annotations_per_resource: Integer,
226227
custom_metric_tag_prefix_list: Array,

spec/unit/actions/service_credential_binding_app_create_spec.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ module V3
194194
let(:binding_2) { ServiceBinding.make(service_instance:, app:, name:) }
195195

196196
before do
197-
# TODO: Remove skip when the service bindings unique constraints are removed
198-
skip 'this test can be enabled when the service bindings unique constraints are removed and max_bindings_per_app_service_instance can be configured'
199-
200197
TestConfig.override(max_service_credential_bindings_per_app_service_instance: 3)
201198
binding_1.save_with_attributes_and_new_operation({}, { type: 'create', state: 'succeeded' })
202199
binding_2.save_with_attributes_and_new_operation({}, { type: 'create', state: 'succeeded' })

spec/unit/lib/cloud_controller/diego/service_binding_files_builder_spec.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ module VCAP::CloudController::Diego
1818
end
1919

2020
context 'when there are multiple bindings with the same name for the same app and service instance' do
21-
before do
22-
# TODO: Remove skip when the service bindings unique constraints are removed
23-
skip 'this test can be enabled when the service bindings unique constraints are removed and max_bindings_per_app_service_instance can be configured'
24-
end
25-
2621
let(:newer_binding_created_at) { Time.now.utc - 2.minutes }
2722

2823
let!(:newer_binding) do

spec/unit/presenters/system_environment/system_env_presenter_spec.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,6 @@ module VCAP::CloudController
131131
end
132132

133133
context 'when there are multiple service bindings for the same service instance' do
134-
before do
135-
# TODO: Remove skip when the service bindings unique constraints are removed
136-
skip 'this test can be enabled when the service bindings unique constraints are removed and max_bindings_per_app_service_instance can be configured'
137-
end
138-
139134
it 'includes only the latest binding' do
140135
newer_binding = ServiceBinding.make(app: app, service_instance: service_instance, syslog_drain_url: 'logs.go-here.com', created_at: Time.now.utc + 10.seconds)
141136

0 commit comments

Comments
 (0)