Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 7e73730

Browse files
authored
v3(servies): Broker provided operation is preserved in between last op polling (cloudfoundry#1920)
[#175302403](https://www.pivotaltracker.com/story/show/175302403)
1 parent 50c8f51 commit 7e73730

4 files changed

Lines changed: 36 additions & 0 deletions

File tree

app/actions/v3/service_binding_create.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def save_last_operation(binding, details)
7171
type: 'create',
7272
state: details[:last_operation][:state],
7373
description: details[:last_operation][:description],
74+
broker_provided_operation: binding.last_operation.broker_provided_operation
7475
}
7576
)
7677
end

spec/request/service_credential_bindings_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,23 @@ def check_filtered_bindings(*bindings)
13061306
expect(Delayed::Job.count).to eq(1)
13071307
end
13081308

1309+
it 'keeps track of the broker operation' do
1310+
execute_all_jobs(expected_successes: 1, expected_failures: 0)
1311+
expect(Delayed::Job.count).to eq(1)
1312+
1313+
Timecop.travel(Time.now + 1.minute)
1314+
execute_all_jobs(expected_successes: 1, expected_failures: 0)
1315+
1316+
expect(
1317+
a_request(:get, broker_binding_last_operation_url).
1318+
with(query: {
1319+
operation: operation,
1320+
service_id: service_instance.service_plan.service.unique_id,
1321+
plan_id: service_instance.service_plan.unique_id,
1322+
})
1323+
).to have_been_made.twice
1324+
end
1325+
13091326
context 'last operation response is 200 OK and indicates success' do
13101327
let(:state) { 'succeeded' }
13111328
let(:fetch_binding_status_code) { 200 }

spec/request/service_route_bindings_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,23 @@
622622
expect(Delayed::Job.count).to eq(1)
623623
end
624624

625+
it 'keeps track of the broker operation' do
626+
execute_all_jobs(expected_successes: 1, expected_failures: 0)
627+
expect(Delayed::Job.count).to eq(1)
628+
629+
Timecop.travel(Time.now + 1.minute)
630+
execute_all_jobs(expected_successes: 1, expected_failures: 0)
631+
632+
expect(
633+
a_request(:get, broker_binding_last_operation_url).
634+
with(query: {
635+
operation: operation,
636+
service_id: service_instance.service_plan.service.unique_id,
637+
plan_id: service_instance.service_plan.unique_id,
638+
})
639+
).to have_been_made.twice
640+
end
641+
625642
context 'last operation response is 200 OK and indicates success' do
626643
let(:state) { 'succeeded' }
627644
let(:fetch_binding_status_code) { 200 }

spec/support/shared_examples/v3_service_binding_create.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ class BadError < StandardError; end
192192
binding.reload
193193
expect(binding.last_operation.state).to eq('in progress')
194194
expect(binding.last_operation.description).to eq(description)
195+
expect(binding.last_operation.broker_provided_operation).to eq(broker_provided_operation)
195196
end
196197
end
197198

0 commit comments

Comments
 (0)