Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869%% Exact exception classification cannot be asserted through HTTP: application%% panics and disappearing actor handles must have different failure behavior.-module(albedo_daemon_request_test).-include_lib("eunit/include/eunit.hrl").
closed_actor_calls_are_unavailable_test() -> lists:foreach( fun(Message) -> Reason = #{ module => <<"gleam/erlang/process">>, function => <<"perform_call">>, message => Message }, ?assertMatch( {error, Message}, albedo_daemon:http_request(fun() -> erlang:error(Reason) end) ) end, [ <<"callee exited: ProcessDown(..., Normal)">>, <<"Callee subject had no owner">>, <<"callee did not send reply before timeout">> ] ).
unrelated_errors_keep_their_reason_test() -> Reasons = [ #{ module => <<"application">>, function => <<"perform_call">>, message => <<"callee exited: unrelated application error">> }, #{ module => <<"gleam/erlang/process">>, function => <<"perform_call">>, message => <<"callee did not send reply before timeout: application error">> }, #{ module => <<"gleam/erlang/process">>, function => <<"application_call">>, message => <<"callee did not send reply before timeout">> }, application_bug ], lists:foreach( fun(Reason) -> ?assertException( error, Reason, albedo_daemon:http_request(fun() -> erlang:error(Reason) end) ) end, Reasons ), ?assertException( throw, application_bug, albedo_daemon:http_request(fun() -> throw(application_bug) end) ).
ordinary_responses_pass_through_test() -> ?assertEqual({ok, response}, albedo_daemon:http_request(fun() -> response end)).