(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func 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 | |
| 44 | func TestRuntimeAPILoop(t *testing.T) { |
| 45 | nInvokes := 10 |
nothing calls this directly
no test coverage detected
searching dependent graphs…