File tree Expand file tree Collapse file tree 3 files changed +2
-31
lines changed
Expand file tree Collapse file tree 3 files changed +2
-31
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def validate_stack(deprecated_stack)
2323 return if deprecated_stack_in_config
2424
2525 deprecated_stack_in_db = false
26- @db . fetch ( 'SELECT * FROM stacks WHERE name LIKE ? ' , deprecated_stack ) do |_row |
26+ @db . fetch ( 'SELECT 1 FROM stacks WHERE name LIKE ? ' , deprecated_stack ) do |_row |
2727 deprecated_stack_in_db = true
2828 end
2929 raise "rake task 'stack_check' failed, stack '#{ deprecated_stack } ' not supported" if deprecated_stack_in_db
Original file line number Diff line number Diff line change @@ -4,9 +4,7 @@ namespace :stacks do
44 logger = Steno . logger ( 'cc.stack' )
55 db = VCAP ::CloudController ::DB . connect ( RakeConfig . config . get ( :db ) , logger )
66 next unless db . table_exists? ( :stacks )
7- next unless db . table_exists? ( :buildpack_lifecycle_data )
87
9- RakeConfig . config . load_db_encryption_key
108 require 'models/helpers/stack_config_file'
119 require 'cloud_controller/check_stacks'
1210 VCAP ::CloudController ::CheckStacks . new ( RakeConfig . config , db ) . validate_stacks
Original file line number Diff line number Diff line change 5252 before do
5353 allow ( db_double ) . to receive ( :table_exists? ) . with ( :stacks ) . and_return true
5454 allow ( VCAP ::CloudController ::DB ) . to receive ( :connect ) . and_return ( db_double )
55- allow ( db_double ) . to receive ( :fetch ) . with ( 'SELECT * FROM stacks WHERE name LIKE ? ' , 'cflinuxfs3' ) . and_return ( '1' )
56- end
57-
58- it 'validates stacks' do
59- expect_any_instance_of ( VCAP ::CloudController ::CheckStacks ) . to receive ( :validate_stacks ) . and_call_original
60- Rake ::Task [ 'stacks:stack_check' ] . execute
61- end
62- end
63- end
64-
65- context 'buildpack_lifecycle_data' do
66- context 'when buildpack_lifecycle_data table doesnt exist' do
67- before do
68- allow ( db_double ) . to receive ( :table_exists? ) . with ( :buildpack_lifecycle_data ) . and_return false
69- allow ( VCAP ::CloudController ::DB ) . to receive ( :connect ) . and_return ( db_double )
70- end
71-
72- it 'does nothing' do
73- expect_any_instance_of ( VCAP ::CloudController ::CheckStacks ) . not_to receive ( :validate_stacks )
74- Rake ::Task [ 'stacks:stack_check' ] . execute
75- end
76- end
77-
78- context 'when buildpack_lifecycle_data table does exist' do
79- before do
80- allow ( double ) . to receive ( :table_exists? ) . with ( :buildpack_lifecycle_data ) . and_return true
81- allow ( VCAP ::CloudController ::DB ) . to receive ( :connect ) . and_return ( db_double )
82- allow ( db_double ) . to receive ( :fetch ) . with ( 'SELECT * FROM stacks WHERE name LIKE ? ' , 'cflinuxfs3' ) . and_return ( '1' )
55+ allow ( db_double ) . to receive ( :fetch ) . with ( 'SELECT 1 FROM stacks WHERE name LIKE ? ' , 'cflinuxfs3' ) . and_return ( '1' )
8356 end
8457
8558 it 'validates stacks' do
You can’t perform that action at this time.
0 commit comments