Documentation ¶
Overview ¶
Package benchttptest proovides utilities for benchttp testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RequestCmpOptions = cmp.Options{ cmp.Transformer("Request", instantiateNilRequest), cmp.Transformer("Request.Header", instantiateNilHeader), cmp.Transformer("Request.URL", stringifyURL), cmpopts.IgnoreUnexported(http.Request{}, tls.ConnectionState{}), cmpopts.IgnoreFields(http.Request{}, unreliableRequestFields...), }
RequestCmpOptions is the cmp.Options used to compare *http.Request. It behaves as follows:
Nil and empty values are considered equal
Fields that depend on how the request was created are ignored to avoid false negatives when comparing requests created in different ways (http.NewRequest vs httptest.NewRequest vs &http.Request{})
Function fields are ignored
Body is ignored: it is compared separately
var RunnerCmpOptions = cmp.Options{ cmpopts.IgnoreUnexported(benchttp.Runner{}), RequestCmpOptions, }
RunnerCmpOptions is the cmp.Options used to compare benchttp.Runner. By default, it ignores unexported fields and includes RequestCmpOptions.
Functions ¶
func AssertEqualRunners ¶
AssertEqualRunners fails t and shows a diff if a and b are not equal, as determined by RunnerCmpOptions.
func DiffRunner ¶
DiffRunner returns a string showing the diff between x and y, as determined by RunnerCmpOptions.
func EqualRunners ¶
EqualRunners returns true if x and y are equal, as determined by RunnerCmpOptions.
Types ¶
This section is empty.