lynx   »   [go: up one dir, main page]

grpctest

package
v1.75.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package grpctest implements testing helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectError added in v1.75.0

func ExpectError(expr string)

ExpectError declares an error to be expected. For the next test, the first error log matching the expression (using FindString) will not cause the test to fail. "For the next test" includes all the time until the next call to Update(). Note that if an expected error is not encountered, this will cause the test to fail.

func ExpectErrorN added in v1.75.0

func ExpectErrorN(expr string, n int)

ExpectErrorN declares an error to be expected n times.

func RunSubTests

func RunSubTests(t *testing.T, x Interface)

RunSubTests runs all "Test___" functions that are methods of x as subtests of the current test. Setup is run before the test function and Teardown is run after.

For example usage, see example_test.go. Run it using:

$ go test -v -run TestExample .

To run a specific test/subtest:

$ go test -v -run 'TestExample/^Something$' .

Types

type Interface added in v1.58.0

type Interface interface {
	Setup(*testing.T)
	Teardown(*testing.T)
}

Interface defines Tester's methods for use in this package.

type Tester added in v1.28.0

type Tester struct{}

Tester is an implementation of the x interface parameter to grpctest.RunSubTests with default Setup and Teardown behavior. Setup updates the tlogger and Teardown performs a leak check. Embed in a struct with tests defined to use.

func (Tester) Setup added in v1.28.0

func (Tester) Setup(t *testing.T)

Setup updates the tlogger.

func (Tester) Teardown added in v1.28.0

func (Tester) Teardown(t *testing.T)

Teardown performs a leak check.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
Лучший частный хостинг