transforms

package
v1.17.0-beta31 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntRegexTransform

func IntRegexTransform(regexp *regexp.Regexp) func(body []byte) (int, error)

IntRegexTransform returns a function that can be used to transform a byte array (e.g., an http.Response body) into an int by applying a regular expression to the byte array. The regular expression must have exactly one capture group. The function will return the integer value of the capture group.

func WithCurlHttpResponse added in v1.17.0

func WithCurlHttpResponse(curlResponse string) *http.Response

WithCurlHttpResponse is a Gomega Transform that converts the string return by an exec.Curl and transforms it into an http.Response. This is useful to be used in tandem with matchers.HaveHttpResponse NOTE: This is not feature complete, as we do not convert the entire response. For now, we handle HTTP/1.1 response headers, status, and body. The curl must be executed with verbose=true to include both the response headers/status and response body.

func WithDecompressorTransform

func WithDecompressorTransform() func(b []byte) string

WithDecompressorTransform returns a Gomega Transform that decompresses a slice of bytes and returns the corresponding string

func WithHeaderKeys added in v1.15.12

func WithHeaderKeys() func(response *http.Response) []string

WithHeaderKeys returns a Gomega Transform that extracts the header keys in a request

func WithHeaderValues

func WithHeaderValues(header string) func(response *http.Response) []string

WithHeaderValues returns a Gomega Transform that extracts the header values from the http Response, for the provided header name

func WithJsonBody

func WithJsonBody() func(b []byte) map[string]interface{}

WithJsonBody returns a Gomega Transform that extracts the JSON body from the response and returns it as a map[string]interface{}

func WithLastValueTransform added in v1.15.19

func WithLastValueTransform() func(rows []*view.Row) (int, error)

WithLastValueTransform returns a function that takes a slice of view.Rows and returns the last value value or an errorß

func WithMedian added in v1.15.0

func WithMedian() func([]time.Duration) time.Duration

WithMedian returns a function that extracts the value at the median from a slice of durations

func WithPercentile added in v1.15.0

func WithPercentile(percentile int) func(durations []time.Duration) time.Duration

WithPercentile returns a function that extracts the value at the given percentile from a slice of durations The Nearest Rank Method is used to determine percentiles (https://en.wikipedia.org/wiki/Percentile#The_nearest-rank_method) Valid inputs are 0 < n <= 100

func WithSumValueTransform added in v1.15.19

func WithSumValueTransform() func(rows []*view.Row) (int, error)

WithSumValueTransform returns a function that takes a slice of view.Rows and returns the sum value or an error. Implemented to be used with counters to get the current total

Types

This section is empty.

Jump to

Keyboard shortcuts

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