Fix: Fragile service name parsing in applyServiceApplicationPrerequisites

Changed from `->before('-')` to `->beforeLast('-')` to correctly parse service
names with hyphens. This fixes prerequisite application for ~230+ services
containing hyphens in their template names (e.g., docker-registry,
elasticsearch-with-kibana).

Added comprehensive test coverage for hyphenated service names and fixed
existing tests to use realistic CUID2 UUID format. All unit tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2025-11-28 17:42:04 +01:00
parent 4706bc23aa
commit 8c40cc607a
6 changed files with 83 additions and 35 deletions

View File

@@ -4,7 +4,6 @@ use App\Actions\Server\UpdateCoolify;
use App\Models\InstanceSettings;
use App\Models\Server;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Http;
beforeEach(function () {
@@ -46,7 +45,7 @@ it('validates cache against running version before fallback', function () {
config(['constants.coolify.version' => '4.0.10']);
$action = new UpdateCoolify();
$action = new UpdateCoolify;
// Should throw exception - cache is older than running
try {
@@ -115,7 +114,7 @@ it('prevents downgrade even with manual update', function () {
// Current version is newer
config(['constants.coolify.version' => '4.0.10']);
$action = new UpdateCoolify();
$action = new UpdateCoolify;
\Illuminate\Support\Facades\Log::shouldReceive('error')
->once()