-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for failure handler with retriable error test
- Loading branch information
Showing
3 changed files
with
57 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
defmodule Inngest.Function.Cases.RetriableTest do | ||
use ExUnit.Case, async: true | ||
|
||
alias Inngest.Test.DevServer | ||
import Inngest.Test.Helper | ||
|
||
@default_sleep 10_000 | ||
@event_name "test/plug.retriable" | ||
|
||
@tag :integration | ||
test "should fail after retrying and failure is handled" do | ||
event_id = send_test_event(@event_name) | ||
Process.sleep(@default_sleep) | ||
|
||
assert {:ok, | ||
%{ | ||
"data" => [ | ||
%{ | ||
"run_id" => _run_id, | ||
"output" => %{ | ||
"error" => "invalid status code: 500", | ||
"message" => stacktrace | ||
}, | ||
"status" => "Failed" | ||
} | ||
] | ||
}} = DevServer.run_ids(event_id) | ||
|
||
assert stacktrace =~ "YOLO!!!" | ||
|
||
{:ok, %{"data" => events}} = DevServer.list_events() | ||
|
||
assert %{"id" => failed_id} = | ||
events | ||
|> Enum.find(fn evt -> | ||
Map.get(evt, "name") == "inngest/function.failed" && | ||
get_in(evt, ["data", "event", "name"]) == @event_name | ||
end) | ||
|
||
assert {:ok, | ||
%{ | ||
"data" => [ | ||
%{ | ||
"run_id" => _, | ||
"output" => "error handled", | ||
"status" => "Completed" | ||
} | ||
] | ||
}} = DevServer.run_ids(failed_id) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters