...

Package echo

import "sigs.k8s.io/gateway-api/conformance/utils/echo"
Overview
Index

Overview ▾

Variables

var (
    URLFieldRegex     = regexp.MustCompile(string(URLField) + "=(.*)")
    ClusterFieldRegex = regexp.MustCompile(string(ClusterField) + "=(.*)")
    IPFieldRegex      = regexp.MustCompile(string(IPField) + "=(.*)")
)

type Field

Field is a list of fields returned in responses from the Echo server.

type Field string
const (
    RequestIDField        Field = "X-Request-Id"
    ServiceVersionField   Field = "ServiceVersion"
    ServicePortField      Field = "ServicePort"
    StatusCodeField       Field = "StatusCode"
    URLField              Field = "URL"
    ForwarderURLField     Field = "Url"
    ForwarderMessageField Field = "Echo"
    ForwarderHeaderField  Field = "Header"
    HostField             Field = "Host"
    HostnameField         Field = "Hostname"
    MethodField           Field = "Method"
    ProtocolField         Field = "Proto"
    AlpnField             Field = "Alpn"
    RequestHeaderField    Field = "RequestHeader"
    ResponseHeaderField   Field = "ResponseHeader"
    ClusterField          Field = "Cluster"
    IPField               Field = "IP" // The Requester’s IP Address.
    LatencyField          Field = "Latency"
    ActiveRequestsField   Field = "ActiveRequests"
    DNSProtocolField      Field = "Protocol"
    DNSQueryField         Field = "Query"
    DNSServerField        Field = "DnsServer"
    CipherField           Field = "Cipher"
    TLSVersionField       Field = "Version"
    TLSServerName         Field = "ServerName"
)

type HeaderType

HeaderType is a helper enum for retrieving Headers from a Response.

type HeaderType string
const (
    RequestHeader  HeaderType = "request"
    ResponseHeader HeaderType = "response"
)

type MeshApplication

type MeshApplication string
const (
    MeshAppEchoV1 MeshApplication = "app=echo,version=v1"
    MeshAppEchoV2 MeshApplication = "app=echo,version=v2"
)

type MeshPod

MeshPod represents a connection to a specific pod running in the mesh. This can be used to trigger requests *from* that pod.

type MeshPod struct {
    Name      string
    Namespace string
    Address   string
    // contains filtered or unexported fields
}

func ConnectToApp

func ConnectToApp(t *testing.T, s *suite.ConformanceTestSuite, app MeshApplication) MeshPod

func ConnectToAppInNamespace

func ConnectToAppInNamespace(t *testing.T, s *suite.ConformanceTestSuite, app MeshApplication, ns string) MeshPod

func (*MeshPod) MakeRequestAndExpectEventuallyConsistentResponse

func (m *MeshPod) MakeRequestAndExpectEventuallyConsistentResponse(t *testing.T, exp http.ExpectedResponse, timeoutConfig config.TimeoutConfig)

type Response

Response represents a response to a single echo request.

type Response struct {
    // RequestURL is the requested URL. This differs from URL, which is the just the path.
    // For example, RequestURL=http://foo/bar, URL=/bar
    RequestURL string
    // Method used (for HTTP).
    Method string
    // Protocol used for the request.
    Protocol string
    // Alpn value (for HTTP).
    Alpn string
    // RawContent is the original unparsed content for this response
    RawContent string
    // ID is a unique identifier of the resource in the response
    ID string
    // URL is the url the request is sent to
    URL string
    // Version is the version of the resource in the response
    Version string
    // Port is the port of the resource in the response
    Port string
    // Code is the response code
    Code string
    // Host is the host called by the request
    Host string
    // Hostname is the host that responded to the request
    Hostname string
    // The cluster where the server is deployed.
    Cluster string
    // IP is the requester's ip address
    IP string

    RequestHeaders  http.Header
    ResponseHeaders http.Header
    // contains filtered or unexported fields
}

func ParseResponse

func ParseResponse(output string) Response

func (Response) Body

func (r Response) Body() []string

Body returns the lines of the response body, in order

func (Response) GetHeaders

func (r Response) GetHeaders(hType HeaderType) http.Header

GetHeaders returns the appropriate headers for the given type.

func (Response) String

func (r Response) String() string