Reduce overhead of health check endpoints

This commit is contained in:
Constantin Graf
2024-09-12 14:02:19 +02:00
committed by Constantin Graf
parent d3545b3c73
commit cc10af0b97
4 changed files with 17 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Tests\Unit\Endpoint\Web;
use App\Http\Controllers\Web\HealthCheckController;
use Illuminate\Support\Facades\DB;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\UsesClass;
@@ -14,10 +15,16 @@ class HealthCheckEndpointTest extends EndpointTestAbstract
{
public function test_up_endpoint_returns_ok(): void
{
// Arrange
DB::enableQueryLog();
DB::flushQueryLog();
// Act
$response = $this->get('health-check/up');
$queryLog = DB::getQueryLog();
// Assert
$this->assertCount(0, $queryLog);
$response->assertSuccessful();
$response->assertExactJson([
'success' => true,