@@ -95,6 +95,28 @@ public function test_supervisor_starts_multiple_pools_when_balancing()
95
95
);
96
96
}
97
97
98
+ public function test_supervisor_starts_pools_with_queues_when_balancing_is_off ()
99
+ {
100
+ $ options = $ this ->supervisorOptions ();
101
+ $ options ->queue = 'first,second ' ;
102
+ $ this ->supervisor = $ supervisor = new Supervisor ($ options );
103
+
104
+ $ supervisor ->scale (2 );
105
+ $ this ->assertCount (2 , $ supervisor ->processes ());
106
+
107
+ $ host = MasterSupervisor::name ();
108
+
109
+ $ this ->assertSame (
110
+ 'exec ' .$ this ->phpBinary .' worker.php redis --name=default --supervisor= ' .$ host .':name --backoff=0 --max-time=0 --max-jobs=0 --memory=128 --queue="first,second" --sleep=3 --timeout=60 --tries=0 --rest=0 ' ,
111
+ $ supervisor ->processes ()[0 ]->getCommandLine ()
112
+ );
113
+
114
+ $ this ->assertSame (
115
+ 'exec ' .$ this ->phpBinary .' worker.php redis --name=default --supervisor= ' .$ host .':name --backoff=0 --max-time=0 --max-jobs=0 --memory=128 --queue="first,second" --sleep=3 --timeout=60 --tries=0 --rest=0 ' ,
116
+ $ supervisor ->processes ()[1 ]->getCommandLine ()
117
+ );
118
+ }
119
+
98
120
public function test_recent_jobs_are_correctly_maintained ()
99
121
{
100
122
$ id = Queue::push (new Jobs \BasicJob );
@@ -154,6 +176,7 @@ public function test_exceptions_are_caught_and_handled_during_loop()
154
176
public function test_supervisor_information_is_persisted ()
155
177
{
156
178
$ this ->supervisor = $ supervisor = new Supervisor ($ options = $ this ->supervisorOptions ());
179
+ $ options ->balance = 'simple ' ;
157
180
$ options ->queue = 'default,another ' ;
158
181
159
182
$ supervisor ->scale (2 );
@@ -184,7 +207,8 @@ public function test_supervisor_repository_returns_null_if_no_supervisor_exists_
184
207
185
208
public function test_processes_can_be_scaled_up ()
186
209
{
187
- $ this ->supervisor = $ supervisor = new Supervisor ($ this ->supervisorOptions ());
210
+ $ this ->supervisor = $ supervisor = new Supervisor ($ options = $ this ->supervisorOptions ());
211
+ $ options ->balance = 'simple ' ;
188
212
189
213
$ supervisor ->scale (2 );
190
214
$ supervisor ->loop ();
@@ -198,6 +222,7 @@ public function test_processes_can_be_scaled_up()
198
222
public function test_processes_can_be_scaled_down ()
199
223
{
200
224
$ this ->supervisor = $ supervisor = new Supervisor ($ options = $ this ->supervisorOptions ());
225
+ $ options ->balance = 'simple ' ;
201
226
$ options ->sleep = 0 ;
202
227
203
228
$ supervisor ->scale (3 );
@@ -468,6 +493,7 @@ public function test_supervisor_processes_can_be_counted_externally()
468
493
{
469
494
SystemProcessCounter::$ command = 'worker.php ' ;
470
495
$ this ->supervisor = $ supervisor = new Supervisor ($ options = $ this ->supervisorOptions ());
496
+ $ options ->balance = 'simple ' ;
471
497
472
498
$ supervisor ->scale (3 );
473
499
$ supervisor ->loop ();
@@ -481,6 +507,7 @@ public function test_supervisor_does_not_start_workers_until_looped_and_active()
481
507
{
482
508
SystemProcessCounter::$ command = 'worker.php ' ;
483
509
$ this ->supervisor = $ supervisor = new Supervisor ($ options = $ this ->supervisorOptions ());
510
+ $ options ->balance = 'simple ' ;
484
511
485
512
$ supervisor ->scale (3 );
486
513
0 commit comments