mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-14 00:33:44 -04:00
- Delete Blade components, component classes, Livewire components and views that nothing uses after the redesign. - Delete tests that only compare Blade/CSS source text; keep the source checks for authorization gates, stable wire:key values and escaping. - Update stale tests to the current UI and behaviour. - Update DESIGN.md to the current navigation and layout. - Add a lesson: test behaviour, not source markup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
2.0 KiB
PHP
56 lines
2.0 KiB
PHP
<?php
|
|
|
|
use App\Models\Server;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('treats Sentinel as enabled for regular servers even when the legacy flag and metrics are disabled', function () {
|
|
DB::table('instance_settings')->insert(['id' => 0]);
|
|
$user = User::factory()->create();
|
|
$server = Server::factory()->create([
|
|
'team_id' => $user->teams()->first()->id,
|
|
]);
|
|
$server->settings->update([
|
|
'is_metrics_enabled' => false,
|
|
'is_sentinel_enabled' => false,
|
|
]);
|
|
|
|
expect($server->fresh()->isSentinelEnabled())->toBeTrue();
|
|
});
|
|
|
|
it('does not enable Sentinel for excluded server types', function (array $settings, array $metadata = []) {
|
|
DB::table('instance_settings')->insert(['id' => 0]);
|
|
$user = User::factory()->create();
|
|
$server = Server::factory()->create([
|
|
'team_id' => $user->teams()->first()->id,
|
|
'server_metadata' => $metadata,
|
|
]);
|
|
$server->settings->update(array_merge([
|
|
'is_metrics_enabled' => false,
|
|
'is_sentinel_enabled' => true,
|
|
], $settings));
|
|
|
|
expect($server->fresh()->isSentinelEnabled())->toBeFalse();
|
|
})->with([
|
|
'build server' => [['server_role' => 'build', 'is_build_server' => true]],
|
|
'swarm manager' => [['is_swarm_manager' => true]],
|
|
'swarm worker' => [['is_swarm_worker' => true]],
|
|
'transferred server' => [[], ['transfer' => ['status' => 'transferred']]],
|
|
'force-disabled server' => [['force_disabled' => true]],
|
|
]);
|
|
|
|
it('keeps metrics optional while Sentinel remains enabled', function () {
|
|
DB::table('instance_settings')->insert(['id' => 0]);
|
|
$user = User::factory()->create();
|
|
$server = Server::factory()->create([
|
|
'team_id' => $user->teams()->first()->id,
|
|
]);
|
|
$server->settings->update(['is_metrics_enabled' => false]);
|
|
|
|
expect($server->fresh()->isSentinelEnabled())->toBeTrue()
|
|
->and((bool) $server->settings->fresh()->is_metrics_enabled)->toBeFalse();
|
|
});
|