Add unit tests for Bird department gate phone call logic, Edge Broker configuration, and gateway heartbeat status. Refactor warnings handling, Slack notifications, Bird client usage, and Edge gateway probes for improved maintainability and error clarity.

This commit is contained in:
Jeppe Bundgaard
2026-04-09 08:53:10 +02:00
parent 45b7250480
commit 9e9372db05
25 changed files with 2924 additions and 201 deletions
@@ -6,6 +6,9 @@ use Exception;
class edge_broker_client
{
private const DEFAULT_BROKER_URL = 'http://edge-broker:4300';
private const DEFAULT_SHARED_SECRET = 'truckwash-edge-dev';
public function __construct(
private readonly ?string $baseUrl = null,
private readonly ?string $sharedSecret = null,
@@ -64,12 +67,15 @@ class edge_broker_client
private function resolveBaseUrl(): string
{
return trim((string)($this->baseUrl ?? getenv('EDGE_BROKER_URL') ?: 'http://edge-broker:4300'));
return trim((string)($this->baseUrl ?? getenv('EDGE_BROKER_URL') ?: self::DEFAULT_BROKER_URL));
}
private function resolveSharedSecret(): string
{
return trim((string)($this->sharedSecret ?? getenv('EDGE_BROKER_SHARED_SECRET') ?: getenv('EDGE_INTERNAL_SECRET') ?: ''));
return trim((string)($this->sharedSecret
?? getenv('EDGE_BROKER_SHARED_SECRET')
?: getenv('EDGE_INTERNAL_SECRET')
?: self::DEFAULT_SHARED_SECRET));
}
/**