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

readbarrier

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package readbarrier synchronizes a test fixture server with the owned provider transport's socket reads. Only tests import it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Barrier

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

Barrier lets a fixture server write its next record only after the client has consumed every byte already sent and is reading the socket again: the deterministic form of a Node fixture's timer between writes, which always outlasts the client's microtask drain.

func New

func New(t *testing.T) *Barrier

New installs read hooks until t ends. Install it once per test function; parallel subtests share it and are told apart by client address.

func (*Barrier) Server

func (barrier *Barrier) Server(t *testing.T, handler http.Handler) *httptest.Server

Server starts handler on a listener that counts bytes written per client.

func (*Barrier) WaitReading

func (barrier *Barrier) WaitReading(ctx context.Context, remote string) bool

WaitReading returns once the client at remote has read everything written to it and has started another socket read.

Jump to

Keyboard shortcuts

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