Test_App_ShutdownWithTimeout() — fiber Function Reference
Architecture documentation for the Test_App_ShutdownWithTimeout() function in app_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 3ccde9a4_1034_80f2_84f3_44b870cea3d1["Test_App_ShutdownWithTimeout()"] e728fdd2_242f_706b_c1d2_041b3d6badb5["app_test.go"] 3ccde9a4_1034_80f2_84f3_44b870cea3d1 -->|defined in| e728fdd2_242f_706b_c1d2_041b3d6badb5 style 3ccde9a4_1034_80f2_84f3_44b870cea3d1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
app_test.go lines 1364–1411
func Test_App_ShutdownWithTimeout(t *testing.T) {
t.Parallel()
app := New()
app.Get("/", func(c Ctx) error {
time.Sleep(5 * time.Second)
return c.SendString("body")
})
ln := fasthttputil.NewInmemoryListener()
serverReady := make(chan struct{}) // Signal that the server is ready to start
go func() {
serverReady <- struct{}{}
err := app.Listener(ln)
assert.NoError(t, err)
}()
<-serverReady // Waiting for the server to be ready
// Create a connection and send a request
connReady := make(chan struct{})
go func() {
conn, err := ln.Dial()
assert.NoError(t, err)
_, err = conn.Write([]byte("GET / HTTP/1.1\r\nHost: google.com\r\n\r\n"))
assert.NoError(t, err)
connReady <- struct{}{} // Signal that the request has been sent
}()
<-connReady // Waiting for the request to be sent
shutdownErr := make(chan error)
go func() {
shutdownErr <- app.ShutdownWithTimeout(1 * time.Second)
}()
timer := time.NewTimer(time.Second * 5)
select {
case <-timer.C:
t.Fatal("idle connections not closed on shutdown")
case err := <-shutdownErr:
if err == nil || !errors.Is(err, context.DeadlineExceeded) {
t.Fatalf("unexpected err %v. Expecting %v", err, context.DeadlineExceeded)
}
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_App_ShutdownWithTimeout() do?
Test_App_ShutdownWithTimeout() is a function in the fiber codebase, defined in app_test.go.
Where is Test_App_ShutdownWithTimeout() defined?
Test_App_ShutdownWithTimeout() is defined in app_test.go at line 1364.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free