package grpctest
import "google.golang.org/grpc/internal/grpctest"
Package grpctest implements testing helpers.
Index ¶
- func ExpectError(expr string)
- func ExpectErrorN(expr string, n int)
- func RunSubTests(t *testing.T, x Interface)
- type Interface
- type Tester
Functions ¶
func ExpectError ¶
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 ¶
ExpectErrorN declares an error to be expected n times.
func RunSubTests ¶
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 ¶
Interface defines Tester's methods for use in this package.
type Tester ¶
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 ¶
Setup updates the tlogger.
func (Tester) Teardown ¶
Teardown performs a leak check.
Source Files ¶
grpctest.go tlogger.go
- Version
- v1.76.0-dev
- Published
- Aug 5, 2025
- Platform
- windows/amd64
- Imports
- 16 packages
- Last checked
- 14 hours ago –
Tools for package owners.