MCPcopy
hub / github.com/valyala/fasthttp / TestServerReduceMemoryUsageSerial

Function TestServerReduceMemoryUsageSerial

server_test.go:1647–1676  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1645}
1646
1647func TestServerReduceMemoryUsageSerial(t *testing.T) {
1648 t.Parallel()
1649
1650 ln := fasthttputil.NewInmemoryListener()
1651
1652 s := &Server{
1653 Handler: func(ctx *RequestCtx) {},
1654 ReduceMemoryUsage: true,
1655 }
1656
1657 ch := make(chan struct{})
1658 go func() {
1659 if err := s.Serve(ln); err != nil {
1660 t.Errorf("unexpected error: %v", err)
1661 }
1662 close(ch)
1663 }()
1664
1665 testServerRequests(t, ln)
1666
1667 if err := ln.Close(); err != nil {
1668 t.Fatalf("error when closing listener: %v", err)
1669 }
1670
1671 select {
1672 case <-ch:
1673 case <-time.After(time.Second):
1674 t.Fatal("timeout when waiting for the server to stop")
1675 }
1676}
1677
1678func TestServerReduceMemoryUsageConcurrent(t *testing.T) {
1679 t.Parallel()

Callers

nothing calls this directly

Calls 4

ServeMethod · 0.95
CloseMethod · 0.95
NewInmemoryListenerFunction · 0.92
testServerRequestsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…