testutil

package
v1.0.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package testutil provides shared testing utilities and mocks. This package contains test helpers that should be excluded from code coverage reporting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithEnv

func WithEnv(key, value string, fn func(logger *MockLogger))

WithEnv temporarily sets an environment variable for the duration of a test function. It automatically restores the original value and sets up a mock logger.

Types

type MockLogger

type MockLogger struct {
	IsFatalCalled bool
	FatalMsg      string
}

MockLogger is a test double for the logger that captures Fatal calls.

func (*MockLogger) Fatal

func (m *MockLogger) Fatal(msg string, fields ...zap.Field)

Fatal implements the logger.Fatal interface for testing purposes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL