mirror of
https://github.com/coollabsio/coolify.git
synced 2026-08-24 02:24:11 -05:00
Namespace terminal container targets by server UUID and bump Coolify to 4.3.11.
40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
|
|
use App\Livewire\Terminal\Index;
|
|
use App\Models\Server;
|
|
use Illuminate\Support\Collection;
|
|
|
|
function terminalServer(string $uuid, string $name, array $containers): Server
|
|
{
|
|
$server = Mockery::mock(Server::class)->makePartial();
|
|
$server->forceFill(['uuid' => $uuid, 'name' => $name]);
|
|
$server->shouldReceive('isFunctional')->once()->andReturnTrue();
|
|
$server->shouldReceive('loadAllContainers')->once()->andReturn(collect($containers));
|
|
|
|
return $server;
|
|
}
|
|
|
|
it('keeps containers with the same name on different servers as distinct terminal targets', function () {
|
|
$component = new Index;
|
|
$component->servers = new Collection([
|
|
terminalServer('pulse-uuid', 'Pulse', [
|
|
['Names' => 'coolify-proxy', 'State' => 'running'],
|
|
['Names' => 'coolify-sentinel', 'State' => 'running'],
|
|
]),
|
|
terminalServer('forge-uuid', 'Forge', [
|
|
['Names' => 'coolify-proxy', 'State' => 'running'],
|
|
['Names' => 'coolify-sentinel', 'State' => 'running'],
|
|
]),
|
|
]);
|
|
|
|
$component->loadContainers();
|
|
|
|
expect($component->containers)->toHaveCount(4)
|
|
->and(collect($component->containers)->pluck('uuid')->all())->toBe([
|
|
'pulse-uuid:coolify-proxy',
|
|
'forge-uuid:coolify-proxy',
|
|
'pulse-uuid:coolify-sentinel',
|
|
'forge-uuid:coolify-sentinel',
|
|
]);
|
|
});
|