File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
lib/cloud_controller/diego
spec/unit/lib/cloud_controller/diego Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,10 @@ def sync
3737 end
3838 end
3939
40- TaskModel . where ( guid : tasks_to_fail ) . each do |cc_task |
41- cc_task . update ( state : TaskModel ::FAILED_STATE , failure_reason : BULKER_TASK_FAILURE )
40+ unless tasks_to_fail . empty?
41+ TaskModel . where ( guid : tasks_to_fail ) . each do |cc_task |
42+ cc_task . update ( state : TaskModel ::FAILED_STATE , failure_reason : BULKER_TASK_FAILURE )
43+ end
4244 end
4345 end
4446
Original file line number Diff line number Diff line change @@ -37,6 +37,12 @@ module Diego
3737 subject . sync
3838 end . not_to ( change { task . reload . state } )
3939 end
40+
41+ it 'does not query tasks with a 1=0 clause' do
42+ expect do
43+ subject . sync
44+ end . to have_queried_db_times ( /select \* from .tasks. where \( 1 = 0\) /i , 0 )
45+ end
4046 end
4147
4248 context 'when a running CC task is missing from BBS' do
You can’t perform that action at this time.
0 commit comments