mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(logs): cap streamed log reads so dockerd does not scan the full log file
Closes #7693
This commit is contained in:
@@ -221,7 +221,7 @@ describe('GetLogs browser-rendered output', function () {
|
||||
->call('getLogs', '2026-09-28T10:00:02.123456789Z')
|
||||
->assertReturned('2026-09-28T10:00:03Z new');
|
||||
|
||||
Process::assertRan(fn ($process) => str_contains(remoteProcessScript($process), 'docker logs --since 2026-09-28T10:00:02.123456789Z -t test-container'));
|
||||
Process::assertRan(fn ($process) => str_contains(remoteProcessScript($process), 'docker logs --since 2026-09-28T10:00:02.123456789Z -n 50000 -t test-container'));
|
||||
});
|
||||
|
||||
test('getLogs prefixes the streaming command with sudo for non-root servers', function () {
|
||||
@@ -234,7 +234,7 @@ describe('GetLogs browser-rendered output', function () {
|
||||
'container' => 'test-container',
|
||||
])->call('getLogs', '2026-09-28T10:00:02Z');
|
||||
|
||||
Process::assertRan(fn ($process) => str_contains(remoteProcessScript($process), '(sudo docker logs --since 2026-09-28T10:00:02Z -t test-container) 2>&1 | head -c'));
|
||||
Process::assertRan(fn ($process) => str_contains(remoteProcessScript($process), '(sudo docker logs --since 2026-09-28T10:00:02Z -n 50000 -t test-container) 2>&1 | head -c'));
|
||||
});
|
||||
|
||||
test('getLogs ignores a since value that is not a docker timestamp', function (string $since) {
|
||||
|
||||
@@ -180,7 +180,7 @@ it('asks each source only for lines after its own timestamp', function () {
|
||||
$frankfurt = collect($commands)->first(fn (string $command): bool => str_contains($command, 'web-frankfurt'));
|
||||
$helsinki = collect($commands)->first(fn (string $command): bool => str_contains($command, 'web-helsinki'));
|
||||
|
||||
expect($frankfurt)->toContain('--since 2026-09-28T10:00:01.123456789Z')
|
||||
expect($frankfurt)->toContain('--since 2026-09-28T10:00:01.123456789Z -n 50000 -t')
|
||||
->and($helsinki)->toContain('docker logs -n ')
|
||||
->and($helsinki)->not->toContain('--since');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user