testutil

package
v0.0.0-...-53b5d8b Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEventually

func AssertEventually(t *testing.T, condition func() bool, timeout time.Duration)

AssertEventually repeatedly checks a condition with timeout

func CreateTestPeerInfo

func CreateTestPeerInfo(id string, addresses ...string) *model.PeerInfo

CreateTestPeerInfo creates a PeerInfo instance for testing

func NewTestServer

func NewTestServer(t *testing.T, handler func(net.Conn)) (string, func())

NewTestServer creates a TCP server for testing with custom message handling

func SendTestMessage

func SendTestMessage(w io.Writer, messageType string, payload interface{}) error

SendTestMessage sends a message to a writer for testing

func SetupTestRepo

func SetupTestRepo(t *testing.T) (*git.Repository, func())

SetupTestRepo creates a temporary git repository for testing

func WaitForCondition

func WaitForCondition(t *testing.T, condition func() bool, timeout time.Duration, message string) bool

WaitForCondition waits for a condition to be true with timeout

func WriteFile

func WriteFile(fs billy.Filesystem, path string, content string) error

WriteFile writes content to a file in a git filesystem

Types

type MockConfig

type MockConfig struct {
	*config.Config // Embed Config to inherit methods
}

MockConfig implements the Config interface

func NewMockConfig

func NewMockConfig() *MockConfig

NewMockConfig creates a new MockConfig with default values

Jump to

Keyboard shortcuts

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