testbudget

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: 6 Imported by: 0

Documentation

Overview

Package testbudget sizes the deadlines tests use to bound a hang.

A test that waits for a subprocess, an extension, or a shell command should return as soon as the awaited event happens; its deadline only decides how long a genuine hang takes to fail. Fixed 5-10 s deadlines turned into failures when many test binaries shared a machine (load average 80 on 14 cores), so waits use Wait instead. Only test code imports this package.

Index

Constants

View Source
const Default = 120 * time.Second

Default matches the extension-conformance connect budget, chosen for -p 12 runs on shared CI runners where builds and Node startup stall for tens of seconds.

View Source
const Env = "PIG_TEST_WAIT_TIMEOUT_SEC"

Env overrides Default with a positive whole number of seconds.

Variables

This section is empty.

Functions

func Context

func Context(t *testing.T) context.Context

Context returns t.Context() bounded by Wait(t).

func Resolve

func Resolve(override string, untilDeadline time.Duration, hasDeadline bool) (time.Duration, error)

Resolve computes a budget from an Env value and the time left before the test deadline.

func Wait

func Wait(t *testing.T) time.Duration

Wait returns the hang bound for t: Default or the Env override, capped to end before t's deadline.

Types

This section is empty.

Jump to

Keyboard shortcuts

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