Skip to content

Commit

Permalink
Fixes laravel#618
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnylot committed Jun 20, 2019
1 parent a6e4a89 commit 2bc4b63
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Repositories/RedisSupervisorRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function update(Supervisor $supervisor)
$pipe->hmset(
'supervisor:'.$supervisor->name, [
'name' => $supervisor->name,
'master' => explode(':', $supervisor->name)[0],
'master' => implode(':',explode(':', $supervisor->name, -1)),
'pid' => $supervisor->pid(),
'status' => $supervisor->working ? 'running' : 'paused',
'processes' => $processes,
Expand Down
34 changes: 34 additions & 0 deletions tests/Controller/MasterSupervisorControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,38 @@ public function test_master_supervisor_listing_with_supervisors()
],
]);
}

public function test_master_supervisor_with_custom_name_listing_with_supervisors()
{
$master = new MasterSupervisor;
$master->name = 'risa:production';
resolve(MasterSupervisorRepository::class)->update($master);

$master2 = new MasterSupervisor;
$master2->name = 'risa:production-2';
resolve(MasterSupervisorRepository::class)->update($master2);

$supervisor = new Supervisor(new SupervisorOptions('risa:production:name', 'redis'));
resolve(SupervisorRepository::class)->update($supervisor);

$response = $this->actingAs(new Fakes\User)->get('/horizon/api/masters');

$response->assertJson([
'risa:production' => [
'name' => 'risa:production',
'status' => 'running',
'supervisors' => [
[
'name' => 'risa:production:name',
'master' => 'risa:production',
'status' => 'running',
'processes' => ['redis:default' => 0],
],
],
],
'risa:production-2' => [
'supervisors' => [],
],
]);
}
}

0 comments on commit 2bc4b63

Please sign in to comment.