Skip to content

Commit

Permalink
Test wildcard environments config (#1465)
Browse files Browse the repository at this point in the history
* test it actually deploys a wildcard environment

* revert test_supervisors_are_added_by_wildcard

* add test_supervisors_are_added_as_fallback_for_wildcard_environments
  • Loading branch information
karkowg authored Jun 17, 2024
1 parent e3dc4ab commit a45917a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/Feature/ProvisioningPlanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit a45917a

Please sign in to comment.