testkit

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testkit runs real SDK handlers without sockets or a Manager checkout

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock struct {
	// contains filtered or unexported fields
}

func NewClock

func NewClock(at time.Time) *Clock

Create a controllable clock at the supplied instant

func (*Clock) Advance

func (c *Clock) Advance(by time.Duration)

Advance the simulated clock atomically

func (*Clock) Now

func (c *Clock) Now() time.Time

Read the current simulated time

type Recorder

type Recorder struct {
	Client *sdk.Client

	History []sdk.Event
	// contains filtered or unexported fields
}

func New

func New(info sdk.HostInfo) *Recorder

Create an in-process host event recorder

func (*Recorder) AssertContexts

func (r *Recorder) AssertContexts(allowed ...string) error

Reject outbound events addressed outside the allowed contexts

func (*Recorder) Drain

func (r *Recorder) Drain() []sdk.Event

Drain the currently captured outbound events

func (*Recorder) Expect

func (r *Recorder) Expect(expected []sdk.Event) error

Compare captured events with the expected sequence

func (*Recorder) Poll

func (r *Recorder) Poll(ctx context.Context, handler sdk.Handler) error

Invoke one handler poll using the recorder client

func (*Recorder) Replay

func (r *Recorder) Replay(ctx context.Context, handler sdk.Handler, events []sdk.Event) error

Replay input events through a plugin handler

Directories

Path Synopsis
Package testutil provides disposable protocol peers; it never connects to a user's accounts, local services or VPN tools
Package testutil provides disposable protocol peers; it never connects to a user's accounts, local services or VPN tools

Jump to

Keyboard shortcuts

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