state

package
v0.0.0-...-593a473 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scenario

type Scenario struct {
	Namespace   string
	IngressName string

	SecretName string

	CapturedRequest  *http.CapturedRequest
	CapturedResponse *http.CapturedResponse

	IPOrFQDN   map[string]string
	NodeIPPort map[string]int32
}

Scenario holds state for a test scenario

func New

func New() *Scenario

New creates a new state to use in a test Scenario

func (*Scenario) AssertMethod

func (s *Scenario) AssertMethod(method string) error

AssertMethod returns an error if the captured request method does not match the expected value

func (*Scenario) AssertRequestHeader

func (s *Scenario) AssertRequestHeader(headerKey string, headerValue string) error

AssertRequestHeader returns an error if the captured request headers do not contain the expected headerKey, or if the matching request header value does not match the expected headerValue. If the headerValue string equals `*`, the header value check is ignored.

func (*Scenario) AssertRequestHost

func (s *Scenario) AssertRequestHost(host string) error

AssertRequestHost returns an error if the captured request host does not match the expected value

func (*Scenario) AssertRequestPath

func (s *Scenario) AssertRequestPath(path string) error

AssertRequestPath returns an error if the captured request path does not match the expected value

func (*Scenario) AssertRequestProto

func (s *Scenario) AssertRequestProto(proto string) error

AssertRequestProto returns an error if the captured request proto does not match the expected value

func (*Scenario) AssertResponseCertificate

func (s *Scenario) AssertResponseCertificate(hostname string) error

AssertResponseCertificate returns nil if the captured certificate for the named host is valid. Otherwise it returns an error describing the mismatch.

func (*Scenario) AssertResponseHeader

func (s *Scenario) AssertResponseHeader(headerKey string, headerValue string) error

AssertResponseHeader returns an error if the captured response headers do not contain the expected headerKey, or if the matching response header value does not match the expected headerValue. If the headerValue string equals `*`, the header value check is ignored.

func (*Scenario) AssertResponseProto

func (s *Scenario) AssertResponseProto(proto string) error

AssertResponseProto returns an error if the captured response proto does not match the expected value

func (*Scenario) AssertServedBy

func (s *Scenario) AssertServedBy(service string) error

AssertServedBy returns an error if the captured request was not served by the expected service

func (*Scenario) AssertStatusCode

func (s *Scenario) AssertStatusCode(statusCode int) error

AssertStatusCode returns an error if the captured response status code does not match the expected value

func (*Scenario) AssertTLSHostname

func (s *Scenario) AssertTLSHostname(hostname string) error

AssertTLSHostname returns an error if the captured TLS response hostname does not match the expected value

func (*Scenario) CaptureRoundTrip

func (s *Scenario) CaptureRoundTrip(method, scheme, hostname, path string, query net_url.Values, headerInfo net_http.Header, doRedirect bool) error

CaptureRoundTrip will perform an HTTP request and return the CapturedRequest and CapturedResponse tuple

Jump to

Keyboard shortcuts

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