Home / File/ services_test.go — fiber Source File

services_test.go — fiber Source File

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

File go FiberCore Routing 1 imports 12 functions 2 classes

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

package fiber

import (
	"bytes"
	"context"
	"errors"
	"fmt"
	"strings"
	"testing"
	"time"

	"github.com/gofiber/fiber/v3/log"
	"github.com/stretchr/testify/require"
)

const (
	terminateErrorMessage = "terminate error"
	startErrorMessage     = "start error"
)

// mockService implements Service interface for testing
type mockService struct {
	startError     error
	terminateError error
	stateError     error
	name           string
	started        bool
	terminated     bool
	startDelay     time.Duration
	terminateDelay time.Duration
}

func (m *mockService) Start(ctx context.Context) error {
	select {
	case <-ctx.Done():
		return fmt.Errorf("context canceled: %w", ctx.Err())
	default:
	}

	if m.startDelay > 0 {
		timer := time.NewTimer(m.startDelay)
		select {
		case <-ctx.Done():
			timer.Stop()
			return fmt.Errorf("context canceled: %w", ctx.Err())
		case <-timer.C:
			// Continue after delay
		}
	}

	if m.startError != nil {
		m.started = false
		return m.startError
	}

	m.started = true
	return nil
}

func (m *mockService) String() string {
// ... (693 more lines)

Domain

Subdomains

Classes

Dependencies

  • bytes

Frequently Asked Questions

What does services_test.go do?
services_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Routing subdomain.
What functions are defined in services_test.go?
services_test.go defines 12 function(s): Benchmark_ServicesMemory, Benchmark_ShutdownServices, Benchmark_ShutdownServices_withContextCancellation, Benchmark_StartServices, Benchmark_StartServices_withContextCancellation, Test_HasConfiguredServices, Test_InitServices, Test_LogServices, Test_NewConfiguredServicesNil, Test_ServiceContextProviders, and 2 more.
What does services_test.go depend on?
services_test.go imports 1 module(s): bytes.
Where is services_test.go in the architecture?
services_test.go is located at services_test.go (domain: FiberCore, subdomain: Routing).

Analyze Your Own Codebase

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

Try Supermodel Free