MCPcopy Create free account
hub / github.com/aws/aws-lambda-go / TestFatalErrors

Function TestFatalErrors

lambda/invoke_loop_test.go:26–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestFatalErrors(t *testing.T) {
27 ts, record := runtimeAPIServer(``, 100)
28 defer ts.Close()
29 handler := NewHandler(func() error {
30 panic(errors.New("a fatal error"))
31 })
32 endpoint := strings.Split(ts.URL, "://")[1]
33 expectedErrorMessage := "calling the handler function resulted in a panic, the process should exit"
34 assert.EqualError(t, startRuntimeAPILoop(endpoint, handler), expectedErrorMessage)
35 assert.Equal(t, 1, record.nGets)
36 var invokeErr messages.InvokeResponse_Error
37 err := json.Unmarshal(record.responses[0], &invokeErr)
38 assert.NoError(t, err)
39 assert.NotNil(t, invokeErr.StackTrace)
40 assert.Equal(t, "errorString", invokeErr.Type)
41 assert.Equal(t, "a fatal error", invokeErr.Message)
42}
43
44func TestRuntimeAPILoop(t *testing.T) {
45 nInvokes := 10

Callers

nothing calls this directly

Calls 4

runtimeAPIServerFunction · 0.85
NewHandlerFunction · 0.85
startRuntimeAPILoopFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…