An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
chore: prepare for PR
Andras Bacsaie9323e35502a
diff --git a/app/Jobs/PushServerUpdateJob.php b/app/Jobs/PushServerUpdateJob.phpindex c02a7e3c5c..5d018cf195 100644--- a/app/Jobs/PushServerUpdateJob.php+++ b/app/Jobs/PushServerUpdateJob.php@@ -207,6 +207,9 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue, Silenced$serviceId = $labels->get('coolify.serviceId');$subType = $labels->get('coolify.service.subType');$subId = $labels->get('coolify.service.subId');+ if (empty($subId)) {+ continue;+ }if ($subType === 'application') {$this->foundServiceApplicationIds->push($subId);// Store container status for aggregationdiff --git a/tests/Feature/PushServerUpdateJobTest.php b/tests/Feature/PushServerUpdateJobTest.phpnew file mode 100644index 0000000000..d508d58aba--- /dev/null+++ b/tests/Feature/PushServerUpdateJobTest.php@@ -0,0 +1,76 @@+<?php++use App\Jobs\PushServerUpdateJob;+use App\Models\Server;+use App\Models\Service;+use App\Models\ServiceApplication;+use Illuminate\Foundation\Testing\RefreshDatabase;++uses(RefreshDatabase::class);++test('containers with empty service subId are skipped', function () {+ $server = Server::factory()->create();+ $service = Service::factory()->create([+ 'server_id' => $server->id,+ ]);+ $serviceApp = ServiceApplication::factory()->create([+ 'service_id' => $service->id,+ ]);++ $data = [+ 'containers' => [+ [+ 'name' => 'test-container',+ 'state' => 'running',+ 'health_status' => 'healthy',+ 'labels' => [+ 'coolify.managed' => true,+ 'coolify.serviceId' => (string) $service->id,+ 'coolify.service.subType' => 'application',+ 'coolify.service.subId' => '',+ ],+ ],+ ],+ ];++ $job = new PushServerUpdateJob($server, $data);++ // Run handle - should not throw a PDOException about empty bigint+ $job->handle();++ // The empty subId container should have been skipped+ expect($job->foundServiceApplicationIds)->not->toContain('');+ expect($job->serviceContainerStatuses)->toBeEmpty();+});++test('containers with valid service subId are processed', function () {+ $server = Server::factory()->create();+ $service = Service::factory()->create([+ 'server_id' => $server->id,+ ]);+ $serviceApp = ServiceApplication::factory()->create([+ 'service_id' => $service->id,+ ]);++ $data = [+ 'containers' => [+ [+ 'name' => 'test-container',+ 'state' => 'running',+ 'health_status' => 'healthy',+ 'labels' => [+ 'coolify.managed' => true,+ 'coolify.serviceId' => (string) $service->id,+ 'coolify.service.subType' => 'application',+ 'coolify.service.subId' => (string) $serviceApp->id,+ 'com.docker.compose.service' => 'myapp',+ ],+ ],+ ],+ ];++ $job = new PushServerUpdateJob($server, $data);+ $job->handle();++ expect($job->foundServiceApplicationIds)->toContain((string) $serviceApp->id);+});