check

package
v0.0.0-...-4b76e91 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alpn

func Alpn(expected string) echo.Checker

func And

func And(checkers ...echo.Checker) echo.Checker

And is an aggregate Checker that requires all Checkers succeed. Any nil Checkers are ignored.

func BodyContains

func BodyContains(expected string) echo.Checker

BodyContains checks that the response body contains the given string.

func Cluster

func Cluster(expected string) echo.Checker

func DestinationIPv4

func DestinationIPv4() echo.Checker

DestinationIPv4 checks the request was received by the server over IPv4

func DestinationIPv6

func DestinationIPv6() echo.Checker

DestinationIPv6 checks the request was received by the server over IPv6

func Each

func Each(v Visitor) echo.Checker

Each applies the given per-response function across all responses.

func Error

func Error() echo.Checker

Error provides a checker that returns an error if the call succeeds.

func ErrorContains

func ErrorContains(expected string) echo.Checker

ErrorContains is similar to Error, but checks that the error message contains the given string.

func ErrorOrNotStatus

func ErrorOrNotStatus(expected int) echo.Checker

func ErrorOrStatus

func ErrorOrStatus(expected int) echo.Checker

func Forbidden

func Forbidden(p protocol.Instance) echo.Checker

Forbidden checks that the response indicates that the request was rejected by RBAC.

func GRPCStatus

func GRPCStatus(expected codes.Code) echo.Checker

GRPCStatus checks that the gRPC response status code matches the expected value.

func Host

func Host(expected string) echo.Checker

func Hostname

func Hostname(expected string) echo.Checker

Hostname checks the hostname the request landed on. This differs from Host which is the request we called.

func IsDNSCaptureEnabled

func IsDNSCaptureEnabled(t framework.TestContext) bool

func MTLSForHTTP

func MTLSForHTTP() echo.Checker

func NoError

func NoError() echo.Checker

NoError is similar to echo.NoChecker, but provides additional context information.

func NoErrorAndStatus

func NoErrorAndStatus(expected int) echo.Checker

NoErrorAndStatus is checks that no error occurred and that the returned status code matches the expected value.

func NotOK

func NotOK() echo.Checker

NotOK is shorthand for ErrorOrNotStatus(http.StatusOK).

func NotStatus

func NotStatus(expected int) echo.Checker

NotStatus checks that the response status code does not match the expected value.

func OK

func OK() echo.Checker

OK is shorthand for NoErrorAndStatus(200).

func Or

func Or(checkers ...echo.Checker) echo.Checker

Or is an aggregate Checker that requires at least one Checker succeeds.

func PlaintextForHTTP

func PlaintextForHTTP() echo.Checker

func Port

func Port(expected int) echo.Checker

func Protocol

func Protocol(expected string) echo.Checker

func ProxyProtocolVersion

func ProxyProtocolVersion(expected string) echo.Checker

func ReachedClusters

func ReachedClusters(allClusters cluster.Clusters, expectedClusters cluster.Clusters) echo.Checker

ReachedClusters returns an error if requests did not load balance as expected.

For cases where all clusters are on the same network, verifies that each of the expected clusters was reached.

For multi-network configurations, verifies the current (limited) Istio load balancing behavior when going through a gateway. Ensures that all expected networks were reached, and that all clusters on the same network as the client were reached.

func ReachedSourceCluster

func ReachedSourceCluster(allClusters cluster.Clusters) echo.Checker

ReachedSourceCluster is similar to ReachedClusters, except it only checks the reachability of source cluster only

func ReachedTargetClusters

func ReachedTargetClusters(t framework.TestContext) echo.Checker

ReachedTargetClusters is similar to ReachedClusters, except that the set of expected clusters is retrieved from the Target of the request.

func RequestHeader

func RequestHeader(key, expected string) echo.Checker

func RequestHeaders

func RequestHeaders(expected map[string]string) echo.Checker

func ResponseHeader

func ResponseHeader(key, expected string) echo.Checker

func ResponseHeaders

func ResponseHeaders(expected map[string]string) echo.Checker

func SourceIPv4

func SourceIPv4() echo.Checker

SourceIPv4 checks the request was sent by the client over IPv4

func SourceIPv6

func SourceIPv6() echo.Checker

SourceIPv6 checks the request was sent by the client over IPv6

func Status

func Status(expected int) echo.Checker

Status checks that the response status code matches the expected value. If the expected value is zero, checks that the response code is unset.

func TooManyRequests

func TooManyRequests() echo.Checker

TooManyRequests checks that at least one message receives a StatusTooManyRequests status code.

func URL

func URL(expected string) echo.Checker

Types

type Visitor

type Visitor func(echoClient.Response) error

Visitor is performs a partial check operation on a single message.

func VNotStatus

func VNotStatus(notExpected int) Visitor

VNotStatus is a Visitor-based version of NotStatus.

func VStatus

func VStatus(expected int) Visitor

VStatus is a Visitor-based version of Status.

func (Visitor) And

func (v Visitor) And(o Visitor) Visitor

And returns a Visitor that performs a logical AND of this Visitor and the one provided.

func (Visitor) Checker

func (v Visitor) Checker() echo.Checker

Checker returns an echo.Checker based on this Visitor.

func (Visitor) Or

func (v Visitor) Or(o Visitor) Visitor

Or returns a Visitor that performs a logical OR of this Visitor and the one provided.

func (Visitor) Visit

func (v Visitor) Visit(r echoClient.Response) error

Visit is a utility method that just invokes this Visitor function on the given response.

Jump to

Keyboard shortcuts

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