1
1
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
# SPDX-License-Identifier: MIT-0
3
3
4
- defmodule Application.Test do
4
+ defmodule ElixirRuntime. Application.Test do
5
5
use ExUnit.Case
6
6
7
7
# This test suite is for the end-to-end behavior of the elixir runtime
8
8
# application. The tests leverage an in-memory client which echos requests
9
9
# back to the test process for validation.
10
10
11
- def echo_msg ( body = % { "msg" => message } , _context ) , do: message
11
+ def echo_msg ( _request = % { "msg" => message } , _context ) , do: message
12
12
13
13
defmodule MyCustomBug do
14
14
defexception [ :message ]
@@ -29,7 +29,7 @@ defmodule Application.Test do
29
29
invocation = Support.FakeInvoke . with_message ( "hello world" )
30
30
expected_id = Support.FakeInvoke . id ( invocation )
31
31
32
- System . put_env ( "_HANDLER" , "Elixir.Application.Test:echo_msg" )
32
+ System . put_env ( "_HANDLER" , "Elixir.ElixirRuntime. Application.Test:echo_msg" )
33
33
start_with_invocations ( [ invocation ] )
34
34
35
35
assert_receive { :next , ^ invocation }
@@ -40,11 +40,19 @@ defmodule Application.Test do
40
40
invoke = Support.FakeInvoke . with_message ( "some message" )
41
41
expected_id = Support.FakeInvoke . id ( invoke )
42
42
43
- System . put_env ( "_HANDLER" , "Elixir.Application.Test:logical_bug_handler" )
43
+ System . put_env (
44
+ "_HANDLER" ,
45
+ "Elixir.ElixirRuntime.Application.Test:logical_bug_handler"
46
+ )
47
+
44
48
start_with_invocations ( [ invoke ] )
45
49
46
50
assert_receive { :invocation_error , msg , ^ expected_id }
47
- assert String . contains? ( msg , "FunctionElixir.Application.Test.MyCustomBug" )
51
+
52
+ assert String . contains? (
53
+ msg ,
54
+ "FunctionElixir.ElixirRuntime.Application.Test.MyCustomBug"
55
+ )
48
56
end
49
57
50
58
test "a missing handler string" do
@@ -80,15 +88,16 @@ defmodule Application.Test do
80
88
# This is the same process as starting the application but it's done
81
89
# piece-by-piece here so the InMemoryClient can be passed into the Runtime
82
90
# and monitor.
83
- defp start_with_invocations ( invocations \\ [ ] ) do
91
+ defp start_with_invocations ( invocations ) do
84
92
start_supervised! (
85
93
{ Support.InMemoryClient , % { pending: invocations , listener: self ( ) } }
86
94
)
87
95
88
- start_supervised! (
89
- { Monitor.Server , [ client: Support.InMemoryClient , name: Monitor ] }
90
- )
96
+ start_supervised! ( {
97
+ ElixirRuntime.Monitor.Server ,
98
+ [ client: Support.InMemoryClient , name: ElixirRuntime.Monitor ]
99
+ } )
91
100
92
- start_supervised! ( { Runtime , [ client: Support.InMemoryClient ] } )
101
+ start_supervised! ( { ElixirRuntime.Loop , [ client: Support.InMemoryClient ] } )
93
102
end
94
103
end
0 commit comments