Skip to content

Latest commit

 

History

History

drpctest

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

package drpctest

import "storj.io/drpc/drpctest"

Package drpctest provides test related helpers.

Usage

type Tracker

type Tracker struct {
	context.Context
}

Tracker keeps track of launched goroutines with a context.

func NewTracker

func NewTracker(tb testing.TB) *Tracker

NewTracker creates a new tracker that inspects the provided TB to see if tests have failed in any of its launched goroutines.

func (*Tracker) Cancel

func (t *Tracker) Cancel()

Cancel cancels the tracker's context.

func (*Tracker) Close

func (t *Tracker) Close()

Close cancels the context and waits for all of the goroutines started by Run to finish.

func (*Tracker) Run

func (t *Tracker) Run(cb func(ctx context.Context))

Run starts a goroutine running the callback with the tracker as the context.

func (*Tracker) Wait

func (t *Tracker) Wait()

Wait blocks until all callbacks started with Run have exited.