test: DeviceIdentification circuit breaker fetch path
This commit is contained in:
parent
a039ff2561
commit
c9ce044830
1 changed files with 11 additions and 0 deletions
|
|
@ -203,6 +203,17 @@ defmodule Aprsme.DeviceIdentificationTest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "fetch_and_upsert_devices circuit-breaker path" do
|
||||||
|
test "returns an error tuple when circuit breaker rejects or HTTP fails" do
|
||||||
|
# This just exercises the fetch_and_upsert_devices path, which runs via
|
||||||
|
# Aprsme.CircuitBreaker.call/3. Without an HTTP stub, this will get an
|
||||||
|
# error back from either the breaker or the underlying Req call.
|
||||||
|
result = DeviceIdentification.fetch_and_upsert_devices()
|
||||||
|
|
||||||
|
assert match?({:error, _}, result) or result == :ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "lookup_device_from_db fallback when cache is unavailable" do
|
describe "lookup_device_from_db fallback when cache is unavailable" do
|
||||||
test "lookup_device_by_identifier falls back to direct DB when DeviceCache is unavailable" do
|
test "lookup_device_by_identifier falls back to direct DB when DeviceCache is unavailable" do
|
||||||
Repo.delete_all(Devices)
|
Repo.delete_all(Devices)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue