testutil

package
v0.0.0-...-7cabe08 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package testutil contains common testing tasks like running dockerd.

Index

Constants

This section is empty.

Variables

View Source
var DevZero io.Reader = devZero{}

DevZero acts like /dev/zero but in an OS-independent fashion.

Functions

func CleanupContext

func CleanupContext(t *testing.T)

func ConfigureTracing

func ConfigureTracing() func(context.Context)

configureTracing sets up an OTLP tracing exporter for use in tests.

func GenerateRandomAlphaOnlyString

func GenerateRandomAlphaOnlyString(n int) string

GenerateRandomAlphaOnlyString generates an alphabetical random string with length n.

func GetContext

func GetContext(t TestingT) context.Context

func RunCommand

func RunCommand(ctx context.Context, cmd string, args ...string) *icmd.Result

func SetContext

func SetContext(t TestingT, ctx context.Context)

func StartSpan

func StartSpan(ctx context.Context, t TestingT) context.Context

StartSpan starts a span for the given test.

Types

type HelperT

type HelperT interface {
	Helper()
}

HelperT is a subset of testing.T that implements the Helper function

type TestingT

type TestingT interface {
	Name() string
	Cleanup(func())
	Log(...any)
	Failed() bool
}

TestingT is an interface wrapper around *testing.T and *testing.B.

Directories

Path Synopsis
Package daemon launches dockerd for testing purposes.
Package daemon launches dockerd for testing purposes.
fixtures

Jump to

Keyboard shortcuts

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