package goroutines

import "github.com/uber/tchannel-go/testutils/goroutines"

Index

Functions

func IdentifyLeaks

func IdentifyLeaks(opts *VerifyOpts) error

IdentifyLeaks looks for extra goroutines, and returns a descriptive error if it finds any.

func VerifyNoLeaks

func VerifyNoLeaks(t testing.TB, opts *VerifyOpts)

VerifyNoLeaks calls IdentifyLeaks and fails the test if it finds any leaked goroutines.

Types

type Stack

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

Stack represents a single Goroutine's stack.

func GetAll

func GetAll() []Stack

GetAll returns the stacks for all running goroutines.

func GetCurrentStack

func GetCurrentStack() Stack

GetCurrentStack returns the stack for the current goroutine.

func (Stack) Full

func (s Stack) Full() []byte

Full returns the full stack trace for this goroutine.

func (Stack) ID

func (s Stack) ID() int

ID returns the goroutine ID.

func (Stack) State

func (s Stack) State() string

State returns the Goroutine's state.

func (Stack) String

func (s Stack) String() string

type VerifyOpts

type VerifyOpts struct {
	// Excludes is a list of strings that will exclude a stack from being considered a leak.
	Excludes []string
}

VerifyOpts contains

func (*VerifyOpts) ShouldSkip

func (opts *VerifyOpts) ShouldSkip(s Stack) bool

ShouldSkip returns whether the given stack should be skipped when doing verification.

Source Files

stacks.go verify.go verify_opts.go

Version
v1.34.6 (latest)
Published
Jan 8, 2025
Platform
windows/amd64
Imports
9 packages
Last checked
1 hour ago

Tools for package owners.