Skip to content

Commit df03384

Browse files
committed
remove last changes
1 parent f78409c commit df03384

File tree

3 files changed

+6
-37
lines changed

3 files changed

+6
-37
lines changed

app/actions/v3/service_broker_update.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def enqueue_update
4545
pollable_job = nil
4646
previous_broker_state = broker.state
4747
ServiceBrokerUpdateRequest.db.transaction do
48+
broker.update(state: ServiceBrokerStateEnum::SYNCHRONIZING)
49+
4850
update_request = ServiceBrokerUpdateRequest.create(params)
4951
MetadataUpdate.update(update_request, message, destroy_nil: false)
5052

app/jobs/v3/services/update_broker_job.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ class Perform
4747
def initialize(update_request_guid, previous_broker_state, user_audit_info:)
4848
@update_request_guid = update_request_guid
4949
@update_request = ServiceBrokerUpdateRequest.find(guid: update_request_guid)
50-
51-
raise 'Service broker update request not found' if @update_request.nil?
52-
5350
@broker = ServiceBroker.find(id: @update_request.service_broker_id)
5451
@previous_broker_state = previous_broker_state
5552
@catalog_updater = VCAP::CloudController::V3::ServiceBrokerCatalogUpdater.new(@broker, user_audit_info:)
@@ -58,8 +55,6 @@ def initialize(update_request_guid, previous_broker_state, user_audit_info:)
5855
def perform
5956
raise CloudController::Errors::V3::ApiError.new_from_details('ServiceBrokerGone') if broker.nil?
6057

61-
broker.update(state: ServiceBrokerStateEnum::SYNCHRONIZING)
62-
6358
ServiceBroker.db.transaction do
6459
broker.update(update_params)
6560

spec/unit/actions/v3/service_broker_update_spec.rb

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -166,24 +166,10 @@ module CloudController
166166
).once
167167
end
168168

169-
it 'does not immediately set the state to SYNCHRONIZING' do
169+
it 'sets the state to SYNCHRONIZING' do
170170
action.enqueue_update
171171

172-
expect(existing_service_broker.state).to eq(ServiceBrokerStateEnum::AVAILABLE)
173-
end
174-
175-
it 'sets the state to SYNCHRONIZING when the job runs' do
176-
action.enqueue_update
177-
178-
broker_state_during_execution = nil
179-
allow_any_instance_of(VCAP::CloudController::V3::ServiceBrokerCatalogUpdater).to receive(:refresh) do
180-
broker_state_during_execution = existing_service_broker.reload.state
181-
nil
182-
end
183-
184-
execute_all_jobs(expected_successes: 1, expected_failures: 0)
185-
expect(broker_state_during_execution).to eq(ServiceBrokerStateEnum::SYNCHRONIZING)
186-
expect(existing_service_broker.reload.state).to eq(ServiceBrokerStateEnum::AVAILABLE)
172+
expect(existing_service_broker.state).to eq(ServiceBrokerStateEnum::SYNCHRONIZING)
187173
end
188174

189175
it 'creates an audit event' do
@@ -251,24 +237,10 @@ module CloudController
251237
context 'legacy service brokers' do
252238
let!(:state) { '' } # broker creating from V2 endpoint will not have a state
253239

254-
it 'does not immediately set the state to SYNCHRONIZING' do
240+
it 'sets the state to SYNCHRONIZING' do
255241
action.enqueue_update
256242

257-
expect(existing_service_broker.reload.state).to eq('')
258-
end
259-
260-
it 'sets the state to SYNCHRONIZING when the job runs' do
261-
action.enqueue_update
262-
263-
broker_state_during_execution = nil
264-
allow_any_instance_of(VCAP::CloudController::V3::ServiceBrokerCatalogUpdater).to receive(:refresh) do
265-
broker_state_during_execution = existing_service_broker.reload.state
266-
nil
267-
end
268-
269-
execute_all_jobs(expected_successes: 1, expected_failures: 0)
270-
expect(broker_state_during_execution).to eq(ServiceBrokerStateEnum::SYNCHRONIZING)
271-
expect(existing_service_broker.reload.state).to eq(ServiceBrokerStateEnum::AVAILABLE)
243+
expect(existing_service_broker.reload.state).to eq(ServiceBrokerStateEnum::SYNCHRONIZING)
272244
end
273245

274246
it 'creates and returns a synchronization job' do

0 commit comments

Comments
 (0)