feat: observe HTTP2 reset and goaway frames

This commit is contained in:
2026-09-23 00:20:37 +08:00
parent 73a05b8c3c
commit 1b9215114f
5 changed files with 137 additions and 3 deletions

View File

@@ -160,6 +160,9 @@ func TestShutdownSendsGoAwayAndDrains(t *testing.T) {
if err := rctx.Err(); err != nil {
t.Fatalf("graceful shutdown canceled active request: %v", err)
}
if stats := s.Stats(); stats.GoAwayFrames != 1 {
t.Fatalf("expected one observed GOAWAY frame, got %+v", stats)
}
select {
case err := <-done:
t.Fatalf("Serve returned before drain: %v", err)
@@ -214,6 +217,9 @@ func TestRSTStreamCancelsOnlyOneRequest(t *testing.T) {
case <-time.After(time.Second):
t.Fatal("RST did not cancel request")
}
if stats := s.Stats(); stats.RSTStreams != 1 {
t.Fatalf("expected one observed RST_STREAM, got %+v", stats)
}
release <- struct{}{}
if got := p.body(t, 3); got != "/survive" {
t.Fatalf("sibling body=%q", got)