drpctest

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 4 Imported by: 0

README

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.

Documentation

Overview

Package drpctest provides test related helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracker

type Tracker struct {
	context.Context
	// contains filtered or unexported fields
}

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.

Jump to

Keyboard shortcuts

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