coolify/tests/Unit/V5/NginxApplicationDeploymentTest.php

36 lines
1.2 KiB
PHP
Raw Normal View History

2026-06-20 07:23:16 +00:00
<?php
use App\Actions\V5\Application\DeployNginxApplication;
use App\Models\V5\Application;
use App\Services\Flux\FluxClient;
2026-06-20 07:23:16 +00:00
use Tests\TestCase;
uses(TestCase::class);
it('builds an nginx container spec for the coold mesh runtime', function () {
2026-06-20 07:23:16 +00:00
$application = new Application([
'name' => 'nginx-test',
'image' => 'docker.io/library/nginx:alpine',
'container_name' => 'coolify-v5-nginx-test',
'mesh_namespace' => 'default',
2026-06-20 07:23:16 +00:00
'status' => 'creating',
]);
$action = new DeployNginxApplication(Mockery::mock(FluxClient::class));
$method = new ReflectionMethod($action, 'containerSpec');
2026-06-20 07:23:16 +00:00
$method->setAccessible(true);
$spec = $method->invoke($action, $application);
2026-06-20 07:23:16 +00:00
expect($spec)
->toMatchArray([
'name' => 'coolify-v5-nginx-test',
'image' => 'docker.io/library/nginx:alpine',
'networks' => ['coolify-default-mesh'],
'network_aliases' => ['coolify-v5-nginx-test'],
'dns_search' => ['default.coolify.internal'],
'restart_policy' => 'unless-stopped',
])
->not->toHaveKey('command')
->not->toHaveKey('privileged');
2026-06-20 07:23:16 +00:00
});