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

Commit c06923a

Browse files
Derik Evangelistapivotal-marcela-campo
authored andcommitted
v3(route-bindings): delete cleans up metadata
[#175092438](https://www.pivotaltracker.com/story/show/175092438)
1 parent 0a3624f commit c06923a

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

spec/request/service_route_bindings_spec.rb

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,13 @@
976976
)
977977
end
978978
let(:guid) { binding.guid }
979+
let(:labels) { { name: 'foo' } }
980+
let(:annotations) { { contact: 'foo@example.com' } }
981+
982+
before do
983+
VCAP::CloudController::LabelsUpdate.update(binding, labels, VCAP::CloudController::RouteBindingLabelModel)
984+
VCAP::CloudController::AnnotationsUpdate.update(binding, annotations, VCAP::CloudController::RouteBindingAnnotationModel)
985+
end
979986

980987
context 'user-provided service instance' do
981988
let(:service_instance) { VCAP::CloudController::UserProvidedServiceInstance.make(space: space, route_service_url: route_service_url) }
@@ -984,6 +991,8 @@
984991
let(:db_check) {
985992
lambda do
986993
expect(VCAP::CloudController::RouteBinding.all).to be_empty
994+
expect(VCAP::CloudController::RouteBindingLabelModel.all).to be_empty
995+
expect(VCAP::CloudController::RouteBindingAnnotationModel.all).to be_empty
987996
end
988997
}
989998

@@ -1051,10 +1060,12 @@
10511060
end
10521061

10531062
context 'when the unbind completes synchronously' do
1054-
it 'removes the binding' do
1063+
it 'removes the binding the associated metadata' do
10551064
execute_all_jobs(expected_successes: 1, expected_failures: 0)
10561065

10571066
expect(VCAP::CloudController::RouteBinding.all).to be_empty
1067+
expect(VCAP::CloudController::RouteBindingLabelModel.all).to be_empty
1068+
expect(VCAP::CloudController::RouteBindingAnnotationModel.all).to be_empty
10581069
end
10591070

10601071
it 'completes the job' do
@@ -1137,10 +1148,12 @@
11371148
let(:state) { 'succeeded' }
11381149
let(:last_operation_status_code) { 200 }
11391150

1140-
it 'removes the binding' do
1151+
it 'removes the binding and its associated metadata' do
11411152
execute_all_jobs(expected_successes: 1, expected_failures: 0)
11421153

11431154
expect(VCAP::CloudController::RouteBinding.all).to be_empty
1155+
expect(VCAP::CloudController::RouteBindingLabelModel.all).to be_empty
1156+
expect(VCAP::CloudController::RouteBindingAnnotationModel.all).to be_empty
11441157
end
11451158

11461159
it 'completes the job' do
@@ -1154,10 +1167,12 @@
11541167
let(:last_operation_status_code) { 410 }
11551168
let(:last_operation_body) { {} }
11561169

1157-
it 'removes the binding' do
1170+
it 'removes the binding and its associated metadata' do
11581171
execute_all_jobs(expected_successes: 1, expected_failures: 0)
11591172

11601173
expect(VCAP::CloudController::RouteBinding.all).to be_empty
1174+
expect(VCAP::CloudController::RouteBindingLabelModel.all).to be_empty
1175+
expect(VCAP::CloudController::RouteBindingAnnotationModel.all).to be_empty
11611176
end
11621177

11631178
it 'completes the job' do
@@ -1178,6 +1193,8 @@
11781193
execute_all_jobs(expected_successes: 0, expected_failures: 1)
11791194

11801195
expect(VCAP::CloudController::RouteBinding.all).not_to be_empty
1196+
expect(VCAP::CloudController::RouteBindingLabelModel.all).not_to be_empty
1197+
expect(VCAP::CloudController::RouteBindingAnnotationModel.all).not_to be_empty
11811198
end
11821199

11831200
it 'puts the error details in the job' do

0 commit comments

Comments
 (0)