Files
coolify/tests/Feature/ApplicationGeneralLayoutTest.php
T
Andras BacsaiandClaude Opus 5.5 60bac941ea fix(servers): build only on dedicated build servers
The server role migration gives every normal server the combined role, and
the build server queries counted combined servers as build servers.
"Use a build server" then built on a random production server, the resource
picker listed each server twice, and "Deployments only" did not stop builds.

- Build server selection and the picker use only "Builds only" servers.
  A null role falls back to the legacy is_build_server flag.
- Without a dedicated build server, builds fall back to the deployment
  server, never to another combined server.
- A "Deployments only" server always builds on a build server and needs a
  Docker image name. It never builds itself, except for restarts. Docker
  image and Compose applications are not affected.
- Setting "Deployments only" requires a dedicated build server.
- The API keeps is_build_server in sync with the role for downgrades.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 11:54:00 +02:00

77 lines
3.3 KiB
PHP

<?php
test('compose actions are grouped with the application details header', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/general.blade.php'));
$applicationDetails = str($view)
->after('class="application-details-card">')
->before('</x-application.settings-section>')
->toString();
expect($applicationDetails)
->toContain('<x-slot:actions>')
->toContain('x-on:click="$wire.dispatch(\'loadCompose\', false)"')
->toContain('Reload compose');
});
test('compose file loading waits for the user to confirm the file location', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/general.blade.php'));
expect($view)
->toContain('x-on:click="$wire.dispatch(\'loadCompose\', false)"')
->not->toContain('x-init="$wire.dispatch(\'loadCompose\', true)"');
});
test('traffic analytics is only shown on the dedicated analytics page', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/general.blade.php'));
expect($view)->not->toContain('<livewire:project.application.traffic-overview');
});
test('docker compose heading separates its title and action', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/general.blade.php'));
expect($view)
->toContain('<div x-data="{ showRaw: true }" class="mt-5">')
->toContain('<div class="mb-2 flex items-center justify-between gap-4">');
});
test('unsaved changes ignore compose initialization state', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/general.blade.php'));
$unsavedBar = str($view)
->after('<x-unsaved-bar action="submit"')
->before('/>')
->toString();
expect($unsavedBar)
->toContain('targets="')
->toContain('name,description')
->not->toContain('initLoadingCompose')
->not->toContain('dockerComposeRaw')
->not->toContain('dockerCompose,');
});
test('onboarding uses the reusable advanced settings component', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/general.blade.php'));
$onboarding = file_get_contents(resource_path('views/livewire/boarding/index.blade.php'));
expect($view)
->toContain('id="dockerComposeCustomBuildCommand"')
->not->toContain('<x-forms.collapsible class="pt-4" content-class="grid gap-4">')
->not->toContain('The following commands are for advanced use cases.')
->and($onboarding)
->toContain('<x-forms.collapsible title="Advanced Connection Settings"');
});
test('deployments-only servers require a registry image because builds run elsewhere', function () {
$view = file_get_contents(resource_path('views/livewire/project/application/general.blade.php'));
$requiredImageCondition = str($view)
->after("@if (\$application->build_pack === 'dockerimage')")
->after('@else')
->before('<x-forms.input id="dockerRegistryImageName" required label="Image"')
->toString();
expect($requiredImageCondition)
->toContain('$application->settings->is_build_server_enabled')
->toContain('! $application->destination->server->canBuildApplications()');
});