@@ -1260,7 +1260,10 @@ def check_filtered_instances(*instances)
1260
1260
expect ( last_response ) . to have_status_code ( 422 )
1261
1261
expect ( parsed_response [ 'errors' ] ) . to include (
1262
1262
include ( {
1263
- 'detail' => 'Invalid service plan. Ensure that the service plan exists, is available, and you have access to it.' ,
1263
+ 'detail' => 'Invalid service plan. This could be due to a space-scoped broker which is offering the service plan ' \
1264
+ "'#{ service_plan . name } ' with guid '#{ service_plan . guid } ' in another space or that the plan " \
1265
+ 'is not enabled in this organization. Ensure that the service plan is visible in your current space ' \
1266
+ "'#{ space . name } ' with guid '#{ space . guid } '." ,
1264
1267
'title' => 'CF-UnprocessableEntity' ,
1265
1268
'code' => 10_008
1266
1269
} )
@@ -1276,7 +1279,9 @@ def check_filtered_instances(*instances)
1276
1279
expect ( last_response ) . to have_status_code ( 422 )
1277
1280
expect ( parsed_response [ 'errors' ] ) . to include (
1278
1281
include ( {
1279
- 'detail' => 'Invalid service plan. Ensure that the service plan exists, is available, and you have access to it.' ,
1282
+ 'detail' => "Invalid service plan. The service plan '#{ service_plan . name } ' with guid '#{ service_plan . guid } ' " \
1283
+ "has been removed from the service broker's catalog. " \
1284
+ 'It is not possible to create new service instances using this plan.' ,
1280
1285
'title' => 'CF-UnprocessableEntity' ,
1281
1286
'code' => 10_008
1282
1287
} )
@@ -2404,6 +2409,26 @@ def check_filtered_instances(*instances)
2404
2409
end
2405
2410
end
2406
2411
2412
+ context 'not enabled in that org' do
2413
+ let ( :service_plan ) { VCAP ::CloudController ::ServicePlan . make ( public : false , active : true ) }
2414
+ let ( :service_plan_guid ) { service_plan . guid }
2415
+
2416
+ it 'fails saying the plan is invalid' do
2417
+ api_call . call ( admin_headers )
2418
+ expect ( last_response ) . to have_status_code ( 422 )
2419
+ expect ( parsed_response [ 'errors' ] ) . to include (
2420
+ include ( {
2421
+ 'detail' => 'Invalid service plan. This could be due to a space-scoped broker which is offering the service plan ' \
2422
+ "'#{ service_plan . name } ' with guid '#{ service_plan . guid } ' in another space or that the plan " \
2423
+ 'is not enabled in this organization. Ensure that the service plan is visible in your current space ' \
2424
+ "'#{ space . name } ' with guid '#{ space . guid } '." ,
2425
+ 'title' => 'CF-UnprocessableEntity' ,
2426
+ 'code' => 10_008
2427
+ } )
2428
+ )
2429
+ end
2430
+ end
2431
+
2407
2432
context 'not available' do
2408
2433
let ( :service_plan ) { VCAP ::CloudController ::ServicePlan . make ( public : true , active : false ) }
2409
2434
let ( :service_plan_guid ) { service_plan . guid }
@@ -2413,7 +2438,9 @@ def check_filtered_instances(*instances)
2413
2438
expect ( last_response ) . to have_status_code ( 422 )
2414
2439
expect ( parsed_response [ 'errors' ] ) . to include (
2415
2440
include ( {
2416
- 'detail' => 'Invalid service plan. Ensure that the service plan exists, is available, and you have access to it.' ,
2441
+ 'detail' => "Invalid service plan. The service plan '#{ service_plan . name } ' with guid '#{ service_plan . guid } ' " \
2442
+ "has been removed from the service broker's catalog. " \
2443
+ 'It is not possible to create new service instances using this plan.' ,
2417
2444
'title' => 'CF-UnprocessableEntity' ,
2418
2445
'code' => 10_008
2419
2446
} )
0 commit comments