Skip to content

Commit 8dff132

Browse files
author
Mohammed Ehab
committed
Add Unit Test
1 parent 8897685 commit 8dff132

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/unit/lambda_server_test.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ def setup
1515
@under_test = RapidClient.new(@server_address, @mock_user_agent)
1616
end
1717

18+
def test_next_invocation_handles_different_signals
19+
['INT', 'TERM', 'QUIT'].each do |signal|
20+
http_mock = Minitest::Mock.new
21+
http_mock.expect(:read_timeout=, nil, [RapidClient::LONG_TIMEOUT_MS])
22+
http_mock.expect(:start, nil) { raise SignalException.new(signal) }
23+
24+
Net::HTTP.stub :new, http_mock do
25+
error = assert_raises(LambdaErrors::InvocationError) do
26+
@under_test.next_invocation
27+
end
28+
29+
assert_match(/Next invocation HTTP request from the runtime interface client was interrupted with a SIG#{signal} SIGNAL, gracefully shutting down./, error.message)
30+
http_mock.verify
31+
end
32+
end
33+
end
34+
1835
def test_post_invocation_error_with_large_xray_cause
1936
large_xray_cause = ('a' * 1024 * 1024)[0..-2]
2037
headers = {'Lambda-Runtime-Function-Error-Type' => @error.runtime_error_type,

0 commit comments

Comments
 (0)