Help us shape the future of Go! Take the 2026 Go Developer Survey

testutil

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package testutil provides test utilities and mocks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestPoolManager

func NewTestPoolManager(t *testing.T) *pool.Manager

NewTestPoolManager creates a new pool.Manager for testing purposes. It initializes a default HTTP connection pool and registers it with the manager.

Types

type MockAuthenticator

type MockAuthenticator struct {
	AuthenticateFunc func(req *http.Request) error
}

MockAuthenticator is a mock implementation of the auth.UpstreamAuthenticator interface.

func (*MockAuthenticator) Authenticate

func (m *MockAuthenticator) Authenticate(req *http.Request) error

Authenticate calls the mock AuthenticateFunc if set, otherwise returns nil.

type MockTool

type MockTool struct {
	ExecuteFunc func(ctx context.Context, req *tool.ExecutionRequest) (any, error)
}

MockTool is a mock implementation of the tool.Tool interface for testing.

func (*MockTool) Execute

func (m *MockTool) Execute(ctx context.Context, req *tool.ExecutionRequest) (any, error)

Execute calls the mock ExecuteFunc if set, otherwise returns nil.

func (*MockTool) GetCacheConfig

func (m *MockTool) GetCacheConfig() *configv1.CacheConfig

GetCacheConfig returns nil for the mock tool.

func (*MockTool) Tool

func (m *MockTool) Tool() *v1.Tool

Tool returns a basic tool definition for the mock tool.

Jump to

Keyboard shortcuts

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