mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 15:32:35 +00:00
#591 - monitoring
This commit is contained in:
@ -4,9 +4,8 @@
|
||||
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Models\Service;
|
||||
use App\Web\Pages\Servers\Metrics\Index;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use Inertia\Testing\AssertableInertia;
|
||||
use Tests\TestCase;
|
||||
|
||||
class MetricsTest extends TestCase
|
||||
@ -25,19 +24,9 @@ public function test_visit_metrics(): void
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
|
||||
$this->get(Index::getUrl(['server' => $this->server]))
|
||||
$this->get(route('monitoring', $this->server))
|
||||
->assertSuccessful()
|
||||
->assertSee('CPU Load')
|
||||
->assertSee('Memory Usage')
|
||||
->assertSee('Disk Usage');
|
||||
}
|
||||
|
||||
public function test_cannot_visit_metrics(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$this->get(Index::getUrl(['server' => $this->server]))
|
||||
->assertForbidden();
|
||||
->assertInertia(fn (AssertableInertia $page) => $page->component('monitoring/index'));
|
||||
}
|
||||
|
||||
public function test_update_data_retention(): void
|
||||
@ -52,13 +41,10 @@ public function test_update_data_retention(): void
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
|
||||
Livewire::test(Index::class, [
|
||||
'server' => $this->server,
|
||||
$this->patch(route('monitoring.update', $this->server), [
|
||||
'data_retention' => 365,
|
||||
])
|
||||
->callAction('data-retention', [
|
||||
'data_retention' => 365,
|
||||
])
|
||||
->assertSuccessful();
|
||||
->assertSessionDoesntHaveErrors();
|
||||
|
||||
$this->assertDatabaseHas('services', [
|
||||
'server_id' => $this->server->id,
|
||||
|
Reference in New Issue
Block a user