Documentation ¶
Index ¶
- func CollectResponse(cluster framework.Cluster, container string, destination string, ...) (types.EchoResponse, 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 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 WithHeader(key, value string) CollectResponsesOptsFn
- func WithMethod(method string) CollectResponsesOptsFn
- func WithNumberOfRequests(numberOfRequests int) CollectResponsesOptsFn
- func WithPathPrefix(prefix string) CollectResponsesOptsFn
- type FailureResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectResponse ¶
func CollectResponse( cluster framework.Cluster, container string, destination string, fn ...CollectResponsesOptsFn, ) (types.EchoResponse, error)
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 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 { NumberOfRequests int 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 CollectResponse 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 WithHeader ¶
func WithHeader(key, value string) CollectResponsesOptsFn
func WithMethod ¶
func WithMethod(method string) CollectResponsesOptsFn
func WithNumberOfRequests ¶
func WithNumberOfRequests(numberOfRequests int) CollectResponsesOptsFn
func WithPathPrefix ¶
func WithPathPrefix(prefix string) CollectResponsesOptsFn
WithPathPrefix injects prefix at the start of the target URL path.
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"` }
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.