@@ -847,12 +847,8 @@ def check_filtered_instances(*instances)
847847 expect ( instance . tags ) . to contain_exactly ( 'foo' , 'bar' , 'baz' )
848848 expect ( instance . credentials ) . to match ( { 'foo' => 'bar' , 'baz' => 'qux' } )
849849 expect ( instance . space ) . to eq ( space )
850-
851- expect_metadata (
852- instance ,
853- annotations : [ { prefix : nil , key : 'foo' , value : 'bar' } ] ,
854- labels : [ { prefix : nil , key : 'baz' , value : 'qux' } ]
855- )
850+ expect ( instance ) . to have_annotations ( { prefix : nil , key : 'foo' , value : 'bar' } )
851+ expect ( instance ) . to have_labels ( { prefix : nil , key : 'baz' , value : 'qux' } )
856852 end
857853
858854 context 'when the name has already been taken' do
@@ -946,11 +942,8 @@ def check_filtered_instances(*instances)
946942 expect ( instance . space ) . to eq ( space )
947943 expect ( instance . service_plan ) . to eq ( service_plan )
948944
949- expect_metadata (
950- instance ,
951- annotations : [ { prefix : nil , key : 'foo' , value : 'bar' } ] ,
952- labels : [ { prefix : nil , key : 'baz' , value : 'qux' } ]
953- )
945+ expect ( instance ) . to have_annotations ( { prefix : nil , key : 'foo' , value : 'bar' } )
946+ expect ( instance ) . to have_labels ( { prefix : nil , key : 'baz' , value : 'qux' } )
954947
955948 expect ( instance . last_operation . type ) . to eq ( 'create' )
956949 expect ( instance . last_operation . state ) . to eq ( 'in progress' )
@@ -1580,18 +1573,15 @@ def check_filtered_instances(*instances)
15801573 service_instance . reload
15811574 expect ( service_instance . tags ) . to eq ( %w( baz quz ) )
15821575
1583- expect_metadata (
1584- service_instance ,
1585- annotations : [
1586- { prefix : 'pre.fix' , key : 'fox' , value : 'bushy' } ,
1587- { prefix : nil , key : 'potato' , value : 'idaho' } ,
1588- { prefix : nil , key : 'style' , value : 'mashed' } ,
1589- ] ,
1590- labels : [
1591- { prefix : 'pre.fix' , key : 'tail' , value : 'fluffy' } ,
1592- { prefix : nil , key : 'potato' , value : 'yam' } ,
1593- { prefix : nil , key : 'style' , value : 'baked' }
1594- ]
1576+ expect ( service_instance ) . to have_annotations (
1577+ { prefix : 'pre.fix' , key : 'fox' , value : 'bushy' } ,
1578+ { prefix : nil , key : 'potato' , value : 'idaho' } ,
1579+ { prefix : nil , key : 'style' , value : 'mashed' } ,
1580+ )
1581+ expect ( service_instance ) . to have_labels (
1582+ { prefix : 'pre.fix' , key : 'tail' , value : 'fluffy' } ,
1583+ { prefix : nil , key : 'potato' , value : 'yam' } ,
1584+ { prefix : nil , key : 'style' , value : 'baked' }
15951585 )
15961586
15971587 expect ( service_instance . last_operation . type ) . to eq ( 'update' )
@@ -1684,16 +1674,13 @@ def check_filtered_instances(*instances)
16841674 service_instance . reload
16851675 expect ( service_instance . reload . tags ) . to eq ( %w( foo bar ) )
16861676
1687- expect_metadata (
1688- service_instance ,
1689- annotations : [
1690- { prefix : 'pre.fix' , key : 'to_delete' , value : 'value' } ,
1691- { prefix : 'pre.fix' , key : 'fox' , value : 'bushy' } ,
1692- ] ,
1693- labels : [
1694- { prefix : 'pre.fix' , key : 'to_delete' , value : 'value' } ,
1695- { prefix : 'pre.fix' , key : 'tail' , value : 'fluffy' }
1696- ]
1677+ expect ( service_instance ) . to have_annotations (
1678+ { prefix : 'pre.fix' , key : 'to_delete' , value : 'value' } ,
1679+ { prefix : 'pre.fix' , key : 'fox' , value : 'bushy' } ,
1680+ )
1681+ expect ( service_instance ) . to have_labels (
1682+ { prefix : 'pre.fix' , key : 'to_delete' , value : 'value' } ,
1683+ { prefix : 'pre.fix' , key : 'tail' , value : 'fluffy' }
16971684 )
16981685 end
16991686
@@ -1921,16 +1908,13 @@ def check_filtered_instances(*instances)
19211908 service_instance . reload
19221909 expect ( service_instance . reload . tags ) . to eq ( %w( foo bar ) )
19231910 expect ( service_instance . service_plan ) . to eq ( original_service_plan )
1924- expect_metadata (
1925- service_instance ,
1926- annotations : [
1927- { prefix : 'pre.fix' , key : 'to_delete' , value : 'value' } ,
1928- { prefix : 'pre.fix' , key : 'fox' , value : 'bushy' } ,
1929- ] ,
1930- labels : [
1931- { prefix : 'pre.fix' , key : 'to_delete' , value : 'value' } ,
1932- { prefix : 'pre.fix' , key : 'tail' , value : 'fluffy' }
1933- ]
1911+ expect ( service_instance ) . to have_annotations (
1912+ { prefix : 'pre.fix' , key : 'to_delete' , value : 'value' } ,
1913+ { prefix : 'pre.fix' , key : 'fox' , value : 'bushy' } ,
1914+ )
1915+ expect ( service_instance ) . to have_labels (
1916+ { prefix : 'pre.fix' , key : 'to_delete' , value : 'value' } ,
1917+ { prefix : 'pre.fix' , key : 'tail' , value : 'fluffy' }
19341918 )
19351919 end
19361920
@@ -2506,10 +2490,10 @@ def check_filtered_instances(*instances)
25062490 let ( :guid ) { service_instance . guid }
25072491 let ( :request_body ) {
25082492 {
2509- metadata : {
2510- labels : { unit : 'metre' , distance : '1003' } ,
2511- annotations : { location : 'london' }
2512- }
2493+ metadata : {
2494+ labels : { unit : 'metre' , distance : '1003' } ,
2495+ annotations : { location : 'london' }
2496+ }
25132497 }
25142498 }
25152499
@@ -2525,10 +2509,10 @@ def check_filtered_instances(*instances)
25252509 api_call . call ( admin_headers )
25262510 expect ( last_response ) . to have_status_code ( 200 )
25272511 expect ( parsed_response [ 'last_operation' ] ) . to include ( {
2528- 'type' => 'create' ,
2529- 'state' => 'in progress' ,
2530- 'description' => 'almost there, I promise'
2531- } )
2512+ 'type' => 'create' ,
2513+ 'state' => 'in progress' ,
2514+ 'description' => 'almost there, I promise'
2515+ } )
25322516 end
25332517 end
25342518
@@ -3866,27 +3850,6 @@ def create_user_provided_json(instance, labels: {}, annotations: {})
38663850 }
38673851 end
38683852
3869- def expect_metadata ( instance , annotations : [ ] , labels : [ ] )
3870- a = instance . annotations . map do |e |
3871- {
3872- prefix : e . key_prefix ,
3873- key : e . key_name ,
3874- value : e . value ,
3875- }
3876- end
3877-
3878- l = instance . labels . map do |e |
3879- {
3880- prefix : e . key_prefix ,
3881- key : e . key_name ,
3882- value : e . value ,
3883- }
3884- end
3885-
3886- expect ( a ) . to match_array ( annotations )
3887- expect ( l ) . to match_array ( labels )
3888- end
3889-
38903853 def share_service_instance ( instance , target_space )
38913854 enable_sharing!
38923855
0 commit comments