Skip to content

Commit a45917a

Browse files
authored
Test wildcard environments config (#1465)
* test it actually deploys a wildcard environment * revert test_supervisors_are_added_by_wildcard * add test_supervisors_are_added_as_fallback_for_wildcard_environments
1 parent e3dc4ab commit a45917a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/Feature/ProvisioningPlanTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,32 @@ public function test_supervisors_are_added_by_wildcard()
6262
$this->assertSame(20, $command->options['maxProcesses']);
6363
}
6464

65+
public function test_supervisors_are_added_as_fallback_for_wildcard_environments()
66+
{
67+
$plan = [
68+
'*' => [
69+
'supervisor-1' => [
70+
'connection' => 'redis',
71+
'queue' => 'first',
72+
'max_processes' => 10,
73+
],
74+
],
75+
];
76+
77+
$plan = new ProvisioningPlan(MasterSupervisor::name(), $plan);
78+
$plan->deploy('develop');
79+
80+
$commands = Redis::connection('horizon')->lrange(
81+
'commands:'.MasterSupervisor::commandQueueFor(MasterSupervisor::name()), 0, -1
82+
);
83+
84+
$this->assertCount(1, $commands);
85+
$command = (object) json_decode($commands[0], true);
86+
$this->assertSame(AddSupervisor::class, $command->command);
87+
$this->assertSame('first', $command->options['queue']);
88+
$this->assertSame(10, $command->options['maxProcesses']);
89+
}
90+
6591
public function test_plan_is_converted_into_array_of_supervisor_options()
6692
{
6793
$plan = [

0 commit comments

Comments
 (0)