Skip to content

Commit

Permalink
add e2e test for panic handler
Browse files Browse the repository at this point in the history
  • Loading branch information
fionera committed Sep 22, 2023
1 parent d5c393f commit 6ec6187
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spop/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ func TestE2E(t *testing.T) {
},
backendCfg: "http-request return status 401 if { var(txn.e2e.error) -m found }",
},
{
name: "recover from panic",
hf: func(ctx context.Context, w *encoding.ActionWriter, m *encoding.Message) {
panic("example panic")
},
tf: func(t *testing.T, config testutil.HAProxyConfig) {
resp, err := http.Get("http://127.0.0.1:" + config.FrontendPort)
if err != nil {
t.Fatal(err)
}

if resp.StatusCode != http.StatusOK {
t.Fatalf("expected %d; got %d", http.StatusOK, resp.StatusCode)
}
},
},
}

t.Parallel()
Expand Down

0 comments on commit 6ec6187

Please sign in to comment.