From a45917ae205e0de1a21b0b95a38e0ed4e1b6bf3f Mon Sep 17 00:00:00 2001 From: Gustavo Karkow <14905932+karkowg@users.noreply.github.com> Date: Mon, 17 Jun 2024 10:15:08 -0400 Subject: [PATCH] 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 --- tests/Feature/ProvisioningPlanTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/Feature/ProvisioningPlanTest.php b/tests/Feature/ProvisioningPlanTest.php index 7bc9fbff..a3ec90e1 100644 --- a/tests/Feature/ProvisioningPlanTest.php +++ b/tests/Feature/ProvisioningPlanTest.php @@ -62,6 +62,32 @@ public function test_supervisors_are_added_by_wildcard() $this->assertSame(20, $command->options['maxProcesses']); } + public function test_supervisors_are_added_as_fallback_for_wildcard_environments() + { + $plan = [ + '*' => [ + 'supervisor-1' => [ + 'connection' => 'redis', + 'queue' => 'first', + 'max_processes' => 10, + ], + ], + ]; + + $plan = new ProvisioningPlan(MasterSupervisor::name(), $plan); + $plan->deploy('develop'); + + $commands = Redis::connection('horizon')->lrange( + 'commands:'.MasterSupervisor::commandQueueFor(MasterSupervisor::name()), 0, -1 + ); + + $this->assertCount(1, $commands); + $command = (object) json_decode($commands[0], true); + $this->assertSame(AddSupervisor::class, $command->command); + $this->assertSame('first', $command->options['queue']); + $this->assertSame(10, $command->options['maxProcesses']); + } + public function test_plan_is_converted_into_array_of_supervisor_options() { $plan = [