istio: Index | Files

package simulation

import ""


Package Files



var (
    ErrNoListener          = errors.New("no listener matched")
    ErrNoFilterChain       = errors.New("no filter chains matched")
    ErrNoRoute             = errors.New("no route matched")
    ErrTLSRedirect         = errors.New("tls required, sending 301")
    ErrNoVirtualHost       = errors.New("no virtual host matched")
    ErrMultipleFilterChain = errors.New("multiple filter chains matched")
    // ErrProtocolError happens when sending TLS/TCP request to HCM, for example
    ErrProtocolError = errors.New("protocol error")
    ErrTLSError      = errors.New("invalid TLS")
    ErrMTLSError     = errors.New("invalid mTLS")

type Call Uses

type Call struct {
    Address string
    Port    int
    Path    string

    // Protocol describes the protocol type. TLS encapsulation is separate
    Protocol Protocol
    // TLS describes the connection tls parameters
    // TODO: currently this does not verify TLS vs mTLS
    TLS  TLSMode
    Alpn string

    // HostHeader is a convenience field for Headers
    HostHeader string
    Headers    http.Header

    Sni string

    // CallMode describes the type of call to make.
    CallMode CallMode

func (Call) FillDefaults Uses

func (c Call) FillDefaults() Call

func (Call) IsHTTP Uses

func (c Call) IsHTTP() bool

type CallMode Uses

type CallMode string
var (
    // CallModeGateway simulate no iptables
    CallModeGateway CallMode = "gateway"
    // CallModeOutbound simulate iptables redirect to 15001
    CallModeOutbound CallMode = "outbound"
    // CallModeInbound simulate iptables redirect to 15006
    CallModeInbound CallMode = "inbound"

type Expect Uses

type Expect struct {
    Name   string
    Call   Call
    Result Result

type Protocol Uses

type Protocol string
const (
    HTTP  Protocol = "http"
    HTTP2 Protocol = "http2"
    TCP   Protocol = "tcp"

type Result Uses

type Result struct {
    Error              error
    ListenerMatched    string
    FilterChainMatched string
    RouteMatched       string
    RouteConfigMatched string
    VirtualHostMatched string
    ClusterMatched     string
    // StrictMatch controls whether we will strictly match the result. If unset, empty fields will
    // be ignored, allowing testing only fields we care about This allows asserting that the result
    // is *exactly* equal, allowing asserting a field is empty
    StrictMatch bool
    // If set, this will mark a test as skipped. Note the result is still checked first - we skip only
    // if we pass the test. This is to ensure that if the behavior changes, we still capture it; the skip
    // just ensures we notice a test is wrong
    Skip string
    // contains filtered or unexported fields

func (Result) Matches Uses

func (r Result) Matches(t *testing.T, want Result)

type Simulation Uses

type Simulation struct {
    Listeners []*listener.Listener
    Clusters  []*cluster.Cluster
    Routes    []*route.RouteConfiguration
    // contains filtered or unexported fields

func NewSimulation Uses

func NewSimulation(t *testing.T, s *xds.FakeDiscoveryServer, proxy *model.Proxy) *Simulation

func NewSimulationFromConfigGen Uses

func NewSimulationFromConfigGen(t *testing.T, s *v1alpha3.ConfigGenTest, proxy *model.Proxy) *Simulation

func (*Simulation) Run Uses

func (sim *Simulation) Run(input Call) (result Result)

func (*Simulation) RunExpectations Uses

func (sim *Simulation) RunExpectations(es []Expect)

type TLSMode Uses

type TLSMode string
const (
    Plaintext TLSMode = "plaintext"
    TLS       TLSMode = "tls"
    MTLS      TLSMode = "mtls"

Package simulation imports 24 packages (graph). Updated 2021-01-27. Refresh now. Tools for package owners.