e2e

package
v0.0.0-...-1d32ed5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StubRelay

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

StubRelay is an in-process fake relay for daemon integration tests. It upgrades a WebSocket, records received frames, and lets the test enqueue frames to send to the connected daemon.

func NewStubRelay

func NewStubRelay(t *testing.T) *StubRelay

NewStubRelay starts a stub relay on a random local port.

func (*StubRelay) Close

func (s *StubRelay) Close()

Close shuts down the underlying httptest server.

func (*StubRelay) Received

func (s *StubRelay) Received() []*protocol.Envelope

Received returns a snapshot of all envelopes received from the daemon.

func (*StubRelay) Send

func (s *StubRelay) Send(payload any) error

Send enqueues a payload to be written to the connected daemon. The payload is marshaled with encoding/json and sent as a single text frame; callers pass concrete protocol message structs (e.g. *protocol.Welcome) directly.

func (*StubRelay) URL

func (s *StubRelay) URL() string

URL returns the ws:// form of the stub relay's HTTP URL.

func (*StubRelay) WaitForConnection

func (s *StubRelay) WaitForConnection(timeout time.Duration) error

WaitForConnection blocks until a daemon connects, or returns an error on timeout.

func (*StubRelay) WaitForFrame

func (s *StubRelay) WaitForFrame(msgType string, timeout time.Duration) (*protocol.Envelope, error)

WaitForFrame polls the received buffer for a frame matching msgType, returning it as soon as it appears or an error on timeout.

Jump to

Keyboard shortcuts

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