mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Co-authored-by: Aditya Tripathi <aditya@climactic.co>
29 lines
1.2 KiB
PHP
29 lines
1.2 KiB
PHP
<?php
|
|
|
|
use App\Models\Application;
|
|
use App\Services\ImageScan\ResourceScans;
|
|
use Symfony\Component\Yaml\Yaml;
|
|
|
|
function composeNamesApp(string $compose): Application
|
|
{
|
|
return new Application(['build_pack' => 'dockercompose', 'docker_compose' => $compose]);
|
|
}
|
|
|
|
it('reads the images of a Compose file again after the file changes, also on the same app', function () {
|
|
$application = composeNamesApp(Yaml::dump(['services' => ['web' => ['image' => 'nginx:1.27'], 'db' => ['image' => 'postgres:16']]]));
|
|
|
|
expect(ResourceScans::composeServiceNames($application))->toBe(['nginx' => 'web', 'postgres' => 'db'])
|
|
->and(ResourceScans::composeServiceNames($application))->toBe(['nginx' => 'web', 'postgres' => 'db']);
|
|
|
|
$application->docker_compose = Yaml::dump(['services' => ['web' => ['image' => 'caddy:2'], 'cache' => ['image' => '${CACHE_IMAGE:-redis:7}']]]);
|
|
|
|
expect(ResourceScans::composeServiceNames($application))->toBe(['caddy' => 'web']);
|
|
});
|
|
|
|
it('reads no images of a Compose file that is not valid YAML, every time', function () {
|
|
$application = composeNamesApp("services:\n web: [");
|
|
|
|
expect(ResourceScans::composeServiceNames($application))->toBe([])
|
|
->and(ResourceScans::composeServiceNames($application))->toBe([]);
|
|
});
|