Home / File/ listen_test.go — fiber Source File

listen_test.go — fiber Source File

Architecture documentation for listen_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Context 1 imports 31 functions 9 classes

Entity Profile

Dependency Diagram

graph LR
  edd60c6a_f37d_c392_5301_d2d5a002990a["listen_test.go"]
  c0b86961_3ef1_0168_52fc_98627566ed27["bytes"]
  edd60c6a_f37d_c392_5301_d2d5a002990a --> c0b86961_3ef1_0168_52fc_98627566ed27
  style edd60c6a_f37d_c392_5301_d2d5a002990a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package fiber

import (
	"bytes"
	"context"
	"crypto/tls"
	"errors"
	"fmt"
	"io"
	"log" //nolint:depguard // TODO: Required to capture output, use internal log package instead
	"net"
	"os"
	"path/filepath"
	"sync"
	"testing"
	"time"

	"github.com/gofiber/utils/v2"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	"github.com/valyala/fasthttp"
	"github.com/valyala/fasthttp/fasthttputil"
	"golang.org/x/crypto/acme/autocert"
)

// go test -run Test_Listen
func Test_Listen(t *testing.T) {
	app := New()

	require.Error(t, app.Listen(":99999"))

	go func() {
		time.Sleep(1000 * time.Millisecond)
		assert.NoError(t, app.Shutdown())
	}()

	require.NoError(t, app.Listen(":0", ListenConfig{DisableStartupMessage: true}))
}

// go test -run Test_Listen_Graceful_Shutdown
func Test_Listen_Graceful_Shutdown(t *testing.T) {
	t.Run("Basic Graceful Shutdown", func(t *testing.T) {
		testGracefulShutdown(t, 0)
	})

	t.Run("Shutdown With Timeout", func(t *testing.T) {
		testGracefulShutdown(t, 500*time.Millisecond)
	})

	t.Run("Shutdown With Timeout Error", func(t *testing.T) {
		testGracefulShutdown(t, 1*time.Nanosecond)
	})
}

func testGracefulShutdown(t *testing.T, shutdownTimeout time.Duration) {
	t.Helper()

	var mu sync.Mutex
	var shutdown bool
	var receivedErr error
// ... (844 more lines)

Domain

Subdomains

Dependencies

  • bytes

Frequently Asked Questions

What does listen_test.go do?
listen_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Context subdomain.
What functions are defined in listen_test.go?
listen_test.go defines 31 function(s): Test_App_Listener_TLS_Listener, Test_Listen, Test_Listen_AutoCert_Conflicts, Test_Listen_BeforeServeFunc, Test_Listen_Graceful_Shutdown, Test_Listen_ListenerAddrFunc, Test_Listen_ListenerNetwork, Test_Listen_ListenerNetwork_Unix, Test_Listen_Master_Process_Show_Startup_Message, Test_Listen_Master_Process_Show_Startup_MessageWithAppName, and 21 more.
What does listen_test.go depend on?
listen_test.go imports 1 module(s): bytes.
Where is listen_test.go in the architecture?
listen_test.go is located at listen_test.go (domain: FiberCore, subdomain: Context).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free