test: improve coverage
Some checks are pending
tests / ci (push) Waiting to run

This commit is contained in:
Benjamin Nussbaum 2025-09-24 00:45:50 +02:00
parent e9fc6b2335
commit 5d3a512203
20 changed files with 1651 additions and 101 deletions

View file

@ -33,16 +33,25 @@ class FirmwareDownloadJob implements ShouldQueue
try {
$filename = "FW{$this->firmware->version_tag}.bin";
Http::sink(storage_path("app/public/firmwares/$filename"))
->get($this->firmware->url);
$response = Http::get($this->firmware->url);
if (! $response->successful()) {
throw new Exception('HTTP request failed with status: '.$response->status());
}
// Save the response content to file
Storage::disk('public')->put("firmwares/$filename", $response->body());
// Only update storage location if download was successful
$this->firmware->update([
'storage_location' => "firmwares/$filename",
]);
} catch (ConnectionException $e) {
Log::error('Firmware download failed: '.$e->getMessage());
// Don't update storage_location on failure
} catch (Exception $e) {
Log::error('An unexpected error occurred: '.$e->getMessage());
// Don't update storage_location on failure
}
}
}