xraytest

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package xraytest contains test helpers for package xray that are used by transport-specific X-Ray middleware tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractSegment

func ExtractSegment(t *testing.T, js string) *xray.Segment

ExtractSegment returns the unmarshalled segment JSON from a ReadUDP response.

func FreeUDPAddr added in v1.4.1

func FreeUDPAddr() string

FreeUDPAddr reserves an ephemeral localhost UDP port and returns its host:port address. The listener is closed before returning so callers can bind the address themselves. Allocating from the ephemeral range keeps concurrent test runs from colliding on a fixed port. It panics on failure because it is meant to be called from TestMain, before any *testing.T exists.

func ReadUDP

func ReadUDP(t *testing.T, udplisten string, expectedMessages int, sender func()) []string

ReadUDP verifies that exactly the expected number of messages are received.

Types

This section is empty.

Jump to

Keyboard shortcuts

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