feat: harden errors, recovery, and resource usage

This commit is contained in:
2026-08-29 23:40:37 +03:00
parent c8e0c9168b
commit d67fd327c9
10 changed files with 525 additions and 32 deletions
+3 -2
View File
@@ -18,7 +18,7 @@ static http_api_t new_api(application_t *application, test_random_t *random) {
http_api_init(&api, application);
http_api_set_health(&api, &(http_api_health_t){.uptime_ms = 12U, .free_heap_bytes = 200000U,
.minimum_free_heap_bytes = 190000U, .largest_free_block_bytes = 180000U,
.connected_clients = 2U, .rejected_input = 3U, .wifi_state = "connected"});
.connected_clients = 2U, .rejected_input = 3U, .reset_reason = 11, .wifi_state = "connected"});
return api;
}
@@ -55,7 +55,8 @@ static void test_public_routes_and_parse_limits(void) {
http_api_response_t response = call(&api, HTTP_API_ROUTE_INFO, HTTP_API_GET, NULL, NULL);
assert(response.status == 200U && response.body_length <= 192U && strstr(response.body, "player1Available") != NULL);
response = call(&api, HTTP_API_ROUTE_HEALTH, HTTP_API_GET, NULL, NULL);
assert(response.status == 200U && response.body_length <= 320U && strstr(response.body, "connected") != NULL);
assert(response.status == 200U && response.body_length <= 320U && strstr(response.body, "connected") != NULL &&
strstr(response.body, "\"resetReason\":11") != NULL);
const http_api_request_t long_target = {.method = HTTP_API_GET, .route = HTTP_API_ROUTE_INFO, .target_too_large = true};
assert(http_api_handle(&api, &long_target, &response));
expect_code(&response, 413U, "PAYLOAD_TOO_LARGE");