add data retention to the metrics

This commit is contained in:
Saeed Vaziry
2024-04-13 22:38:27 +02:00
parent ddacc32e64
commit 52d195710b
18 changed files with 346 additions and 140 deletions

View File

@ -35,6 +35,29 @@ public function test_cannot_visit_metrics(): void
$this->actingAs($this->user);
$this->get(route('servers.metrics', ['server' => $this->server]))
->assertRedirect(route('servers.services', ['server' => $this->server]));
->assertNotFound();
}
public function test_update_data_retention(): void
{
$this->actingAs($this->user);
Service::factory()->create([
'server_id' => $this->server->id,
'name' => 'vito-agent',
'type' => 'monitoring',
'version' => 'latest',
'status' => ServiceStatus::READY,
]);
$this->post(route('servers.metrics.settings', ['server' => $this->server]), [
'data_retention' => 30,
])->assertSessionHas('toast.type', 'success');
$this->assertDatabaseHas('services', [
'server_id' => $this->server->id,
'type' => 'monitoring',
'type_data->data_retention' => 30,
]);
}
}