Home / Function/ Test_LogServices() — fiber Function Reference

Test_LogServices() — fiber Function Reference

Architecture documentation for the Test_LogServices() function in services_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  a25cabec_2bf6_8d85_e67d_b6edae069cff["Test_LogServices()"]
  a3b050d2_f10a_df85_e082_e3ac664a6a6c["services_test.go"]
  a25cabec_2bf6_8d85_e67d_b6edae069cff -->|defined in| a3b050d2_f10a_df85_e082_e3ac664a6a6c
  style a25cabec_2bf6_8d85_e67d_b6edae069cff fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

services_test.go lines 423–466

func Test_LogServices(t *testing.T) {
	t.Parallel()
	// Service with successful State
	runningService := &mockService{name: "running", started: true}
	// Service with State error
	errorService := &mockService{name: "error", stateError: errors.New("state error")}

	expectedState := newState()
	expectedState.setService(runningService)
	expectedState.setService(errorService)

	app := &App{
		configured: Config{
			Services: []Service{runningService, errorService},
		},
		state: expectedState,
	}

	var buf bytes.Buffer

	colors := Colors{
		Green: "\033[32m",
		Reset: "\033[0m",
		Blue:  "\033[34m",
		Red:   "\033[31m",
	}

	err := app.logServices(context.Background(), &buf, &colors)
	require.NoError(t, err)

	output := buf.String()

	for _, srv := range app.state.Services() {
		stateColor := colors.Blue
		state := "RUNNING"
		if _, err := srv.State(context.Background()); err != nil {
			stateColor = colors.Red
			state = "ERROR"
		}

		expected := fmt.Sprintf("%sINFO%s    🧩 %s[ %s ] %s%s\n", colors.Green, colors.Reset, stateColor, strings.ToUpper(state), srv.String(), colors.Reset)
		require.Contains(t, output, expected)
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Test_LogServices() do?
Test_LogServices() is a function in the fiber codebase, defined in services_test.go.
Where is Test_LogServices() defined?
Test_LogServices() is defined in services_test.go at line 423.

Analyze Your Own Codebase

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

Try Supermodel Free