@@ -125,8 +125,12 @@ class TestHelpers
125125 { 'name' => 'p2' }
126126 ]
127127
128- allow ( redis ) . to receive ( :pipelined ) . with ( no_args ) . and_return [ 1 , 1 ]
129- allow ( redis ) . to receive ( :get ) . and_return ( 1 , 0 )
128+ # Mock returns 7*2 + 2 = 16 results (7 queue types for 2 pools + 2 global counters)
129+ # For each pool: [request, processing, odcreate, pending, ready, running, completed]
130+ # Plus 2 global counters: clone (1), ondemandclone (0)
131+ # Results array: [1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1, 0]
132+ # [req, proc, odc, pend, rdy, run, comp, clone, odc]
133+ allow ( redis ) . to receive ( :pipelined ) . with ( no_args ) . and_return [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 ]
130134
131135 expect ( subject . get_queue_metrics ( pools , redis ) ) . to eq ( { requested : 6 , pending : 2 , cloning : 1 , booting : 1 , ready : 2 , running : 2 , completed : 2 , total : 14 } )
132136 end
@@ -137,8 +141,8 @@ class TestHelpers
137141 { 'name' => 'p2' }
138142 ]
139143
140- allow ( redis ) . to receive ( :pipelined ) . with ( no_args ) . and_return [ 1 , 1 ]
141- allow ( redis ) . to receive ( :get ) . and_return ( 5 , 0 )
144+ # Mock returns 7*2 + 2 = 16 results with clone=5 to cause negative booting
145+ allow ( redis ) . to receive ( :pipelined ) . with ( no_args ) . and_return [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 5 , 0 ]
142146
143147 expect ( subject . get_queue_metrics ( pools , redis ) ) . to eq ( { requested : 6 , pending : 2 , cloning : 5 , booting : 0 , ready : 2 , running : 2 , completed : 2 , total : 14 } )
144148 end
0 commit comments