< Summary - Backend C Tests - Coverage Report (WSL)

Information
Class: test_db_pool_basic_c
Assembly: src.backend.tests.unit.database
File(s): ./src/backend/tests/unit/database/test_db_pool_basic.c
Line coverage
100%
Covered lines: 20
Uncovered lines: 0
Coverable lines: 20
Total lines: 32
Line coverage: 100%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 2/18/2026 - 10:50:55 PM Line coverage: 100% (20/20) Branch coverage: 50% (2/4) Total lines: 32 2/18/2026 - 10:50:55 PM Line coverage: 100% (20/20) Branch coverage: 50% (2/4) Total lines: 32

File(s)

./src/backend/tests/unit/database/test_db_pool_basic.c

#LineLine coverage
 1#include <stdio.h>
 2#include <assert.h>
 3#include <string.h>
 4#include "db_connection.h"
 5
 16void test_pool_exhaustion_fail_fast() {
 7  DatabaseConfig cfg;
 18  memset(&cfg, 0, sizeof(DatabaseConfig));
 19  cfg.pool_min = 1;
 110  cfg.pool_max = 1;
 11  // Initialize pool. Connections will likely fail in local test environment.
 112  db_pool_init(&cfg, FAIL_FAST, 0);
 13  // Attempting to acquire when all (failed) connections are NULL
 14  // should trigger lazy creation, which also fails, and then FAIL_FAST.
 115  DBConnection *c = db_pool_acquire();
 116  assert(c == NULL);
 117  PoolMetrics m = db_pool_get_metrics();
 118  assert(m.acquire_cnt == 0); // No successful acquires
 119  db_pool_destroy();
 120  printf("Pool Exhaustion Fail Fast Test Passed\n");
 121}
 22
 123void run_db_pool_basic_tests() {
 124  printf("Running DB Pool Basic Tests...\n");
 125  test_pool_exhaustion_fail_fast();
 126  printf("DB Pool Basic Tests Passed!\n");
 127}
 28
 129int main() {
 130  run_db_pool_basic_tests();
 131  return 0;
 32}

Methods/Properties