Documentation
¶
Index ¶
- func CollectEchoResponse(cluster framework.Cluster, container string, destination string, ...) (types.EchoResponse, error)
- func CollectResponse(cluster framework.Cluster, container string, destination string, ...) (string, string, error)
- func CollectResponseDirectly(destination string, fn ...CollectResponsesOptsFn) (types.EchoResponse, error)
- func CollectResponses(cluster framework.Cluster, source, destination string, ...) ([]types.EchoResponse, error)
- func CollectResponsesByInstance(cluster framework.Cluster, source, destination string, ...) (map[string]int, error)
- func CollectTCPResponse(cluster framework.Cluster, container string, destination string, stdin string, ...) (string, error)
- func CollectTLSResponse(cluster framework.Cluster, container string, destination string, stdin string, ...) (string, error)
- func CountResponseCodes(statusCode int) func(responses []FailureResponse) int
- func IndexByResponseCode(responses []FailureResponse) map[int]int
- func MakeDirectRequest(destination string, fn ...CollectResponsesOptsFn) (*http.Response, error)
- type CollectResponsesOpts
- type CollectResponsesOptsFn
- func FromKubernetesPod(namespace string, application string) CollectResponsesOptsFn
- func Insecure() CollectResponsesOptsFn
- func NoFail() CollectResponsesOptsFn
- func OutputFormat(format string) CollectResponsesOptsFn
- func Resolve(hostPort string, address string) CollectResponsesOptsFn
- func WithCACert(cacert string) CollectResponsesOptsFn
- func WithHeader(key, value string) CollectResponsesOptsFn
- func WithMaxConcurrentRequestDelayMs(maxConcurrentRequestDelayMs uint) CollectResponsesOptsFn
- func WithMaxConcurrentRequests(maxConcurrentRequests uint) CollectResponsesOptsFn
- func WithMaxTime(seconds uint) CollectResponsesOptsFn
- func WithMethod(method string) CollectResponsesOptsFn
- func WithNumberOfRequests(numberOfRequests uint) CollectResponsesOptsFn
- func WithPathPrefix(prefix string) CollectResponsesOptsFn
- func WithVerbose() CollectResponsesOptsFn
- func WithoutRetries() CollectResponsesOptsFn
- type FailureResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectEchoResponse ¶
func CollectEchoResponse( cluster framework.Cluster, container string, destination string, fn ...CollectResponsesOptsFn, ) (types.EchoResponse, error)
func CollectResponse ¶
func CollectResponseDirectly ¶
func CollectResponseDirectly( destination string, fn ...CollectResponsesOptsFn, ) (types.EchoResponse, error)
CollectResponseDirectly collects responses using http client that calls the server from outside the cluster
func CollectResponses ¶
func CollectResponses(cluster framework.Cluster, source, destination string, fn ...CollectResponsesOptsFn) ([]types.EchoResponse, error)
func CollectTCPResponse ¶
func CollectTLSResponse ¶
func CountResponseCodes ¶ added in v2.11.8
func CountResponseCodes(statusCode int) func(responses []FailureResponse) int
func IndexByResponseCode ¶ added in v2.11.8
func IndexByResponseCode(responses []FailureResponse) map[int]int
func MakeDirectRequest ¶
func MakeDirectRequest( destination string, fn ...CollectResponsesOptsFn, ) (*http.Response, error)
MakeDirectRequest collects responses using http client that calls the server from outside the cluster
Types ¶
type CollectResponsesOpts ¶
type CollectResponsesOpts struct {
URL string
Method string
Headers map[string]string
Flags []string
ShellEscaped func(string) string
// contains filtered or unexported fields
}
func CollectOptions ¶
func CollectOptions(requestURL string, options ...CollectResponsesOptsFn) CollectResponsesOpts
func DefaultCollectResponsesOpts ¶
func DefaultCollectResponsesOpts() CollectResponsesOpts
type CollectResponsesOptsFn ¶
type CollectResponsesOptsFn func(opts *CollectResponsesOpts)
func FromKubernetesPod ¶
func FromKubernetesPod(namespace string, application string) CollectResponsesOptsFn
FromKubernetesPod executes the curl command from a pod belonging to the specified Kubernetes deployment. The cluster must be a Kubernetes cluster, and the deployment must have an "app" label that matches the application parameter.
Note that the caller of CollectEchoResponse still needs to specify the source container name within the Pod.
func Insecure ¶
func Insecure() CollectResponsesOptsFn
Insecure sets the curl --insecure flag. See https://curl.se/docs/manpage.html#-k.
func NoFail ¶
func NoFail() CollectResponsesOptsFn
NoFail removes the default curl --fail flag. See https://curl.se/docs/manpage.html#-f.
func OutputFormat ¶
func OutputFormat(format string) CollectResponsesOptsFn
OutputFormat sets the curl --write-out flag. See https://everything.curl.dev/usingcurl/verbose/writeout.
func Resolve ¶
func Resolve(hostPort string, address string) CollectResponsesOptsFn
Resolve sets the curl --resolve flag. See https://curl.se/docs/manpage.html#--resolve.
func WithCACert ¶
func WithCACert(cacert string) CollectResponsesOptsFn
func WithHeader ¶
func WithHeader(key, value string) CollectResponsesOptsFn
func WithMaxConcurrentRequestDelayMs ¶
func WithMaxConcurrentRequestDelayMs(maxConcurrentRequestDelayMs uint) CollectResponsesOptsFn
Number of milliseconds as an int
func WithMaxConcurrentRequests ¶
func WithMaxConcurrentRequests(maxConcurrentRequests uint) CollectResponsesOptsFn
func WithMaxTime ¶
func WithMaxTime(seconds uint) CollectResponsesOptsFn
func WithMethod ¶
func WithMethod(method string) CollectResponsesOptsFn
func WithNumberOfRequests ¶
func WithNumberOfRequests(numberOfRequests uint) CollectResponsesOptsFn
func WithPathPrefix ¶
func WithPathPrefix(prefix string) CollectResponsesOptsFn
WithPathPrefix injects prefix at the start of the target URL path.
func WithVerbose ¶
func WithVerbose() CollectResponsesOptsFn
func WithoutRetries ¶
func WithoutRetries() CollectResponsesOptsFn
type FailureResponse ¶
type FailureResponse struct {
Exitcode int `json:"exitcode"`
ResponseCode int `json:"response_code"`
Method string `json:"method"`
Scheme string `json:"scheme"`
ContentType string `json:"content_type"`
URL string `json:"url"`
EffectiveURL string `json:"url_effective"`
RedirectURL string `json:"redirect_url"`
}
FailureResponse is the JSON output for a Curl command. Note that the available fields depend on the Curl version, which must be at least 7.70.0 for this feature.
See https://curl.se/docs/manpage.html#-w.
func CollectFailure ¶
func CollectFailure(cluster framework.Cluster, container, destination string, fn ...CollectResponsesOptsFn) (FailureResponse, error)
CollectFailure runs Curl to fetch a URL that is expected to fail. The Curl JSON output is returned so the caller can inspect the failure to see whether it was what was expected.
func CollectResponsesAndFailures ¶
func CollectResponsesAndFailures( cluster framework.Cluster, container, destination string, fn ...CollectResponsesOptsFn, ) ([]FailureResponse, error)