utils

package
v0.0.0-...-e6f3555 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StdlibHTTPClient = http.DefaultClient

Functions

func ExplodeEmbed

func ExplodeEmbed(t *testing.T, efs embed.FS) string

func IncludeLicenseEnvVars

func IncludeLicenseEnvVars(e *testscript.Env) error

func IsTCPPortBindable

func IsTCPPortBindable(port int) bool

Tries an open port 3x times with short delays between each time to ensure the port is really free.

func TestscriptExtraFunctions

func TestscriptExtraFunctions() map[string]func(*testscript.TestScript, bool, []string)

TestscriptExtraFunctions returns extra functions uitable for use with the testscript package, which might be useful for tests. The benefit of implementing such functionality in this way rather than using a shell script, or another scripting tool like babashka or python, is that we can ensure that the custom commands are available on all platforms without needing to set up any special PATH variables or install extra depenandices, which can be an issue in CI, especially for cross testing.

These additional functions are available:

httpwait <url> <expected value> [<retries>] [<interval>] [<backoff coefficient>]

httpwait will repeatedly request thie given URL until it receives a
body response that equals the expected value. Both values are trimmed
before comparison. If the check fails, it will be retried up to
<retries> many times, waiting <interval> ms after each retry, with the
<interval> being multiplied by the backoff coefficient during each
iteration.

defaults:  retries=8 interval=128 backoff=2

Types

This section is empty.

Jump to

Keyboard shortcuts

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