Add timeout settings for Shelly cloud HTTP requests and update related tests

This commit is contained in:
Jeppe Bundgaard
2026-06-09 14:03:12 +02:00
parent aca8be51dc
commit 5c67fe419f
5 changed files with 23 additions and 7 deletions
@@ -14,6 +14,17 @@ it('enforces a global 2 second Shelly gate in sendPostRequest', function (): voi
expect($sendPostRequestBody)->toContain('$this->waitForShellyRateLimitWindow();');
});
it('bounds Shelly cloud HTTP requests with curl timeouts', function (): void {
$shellyClass = file_get_contents(app_path('classes/shelly.php'));
expect($shellyClass)->not->toBeFalse();
expect($shellyClass)->toContain('private const SHELLY_CONNECT_TIMEOUT_SECONDS = 2;');
expect($shellyClass)->toContain('private const SHELLY_REQUEST_TIMEOUT_SECONDS = 5;');
expect($shellyClass)->toContain('CURLOPT_CONNECTTIMEOUT, self::SHELLY_CONNECT_TIMEOUT_SECONDS');
expect($shellyClass)->toContain('CURLOPT_TIMEOUT, self::SHELLY_REQUEST_TIMEOUT_SECONDS');
expect($shellyClass)->toContain('CURLOPT_NOSIGNAL, true');
});
it('uses Redis NX PX semantics for cross-request Shelly rate limiting', function (): void {
$shellyClass = file_get_contents(app_path('classes/shelly.php'));