e2e

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CaddyConfigTemplate = `` /* 969-byte string literal not displayed */

CaddyConfigTemplate is the Caddy app config loaded from consul at test time; ConsulEndpoint is substituted so the proxy can reach consul from inside its container network.

Variables

This section is empty.

Functions

func DeleteACLConfig

func DeleteACLConfig(client *capi.Client) error

func ExpectHostUnreachable

func ExpectHostUnreachable(drv Driver, url, host string)

ExpectHostUnreachable asserts that the hostname is not published by the proxy. Caddy's internal TLS automation only provisions certs for configured hostnames, so an un-routed host fails the TLS handshake rather than returning a clean HTTP status — this helper tolerates either shape.

func ExpectNoRecords

func ExpectNoRecords(res Resolver, server, name string)

ExpectNoRecords asserts that name is not answered by the cadet plugin. Unanswered names fall through to the next plugin; with none configured that surfaces as SERVFAIL, so this only asserts on the empty answer.

func ExpectRecords

func ExpectRecords(res Resolver, server, name string, addrs ...string)

ExpectRecords resolves name through res and asserts the answer contains exactly the given A record addresses, in any order.

func ExpectServiceRequest

func ExpectServiceRequest(drv Driver, url, host string, statusCode int, body string)

ExpectServiceRequest issues a request through drv and asserts the response code and body match the expected values. Must be called from inside a Ginkgo spec (or BeforeEach/AfterEach): it uses Gomega matchers.

func FormatCaddyConfig

func FormatCaddyConfig(endpoint string) []byte

func GenerateUUID

func GenerateUUID() string

GenerateUUID returns a short base62-encoded uuid, used as a per-spec service tag so stale catalog entries can't collide across specs.

func NewConsulClient

func NewConsulClient(addr string) (*capi.Client, error)

func WriteACLConfig

func WriteACLConfig(client *capi.Client, cfg []byte) error

func WriteCaddyConfig

func WriteCaddyConfig(client *capi.Client, cfg []byte) error

func WriteZoneConfig

func WriteZoneConfig(client *capi.Client) error

Types

type Driver

type Driver struct {
	Endpoint string
}

func (Driver) Request

func (drv Driver) Request(url, host string) (int, string, error)

type Request

type Request struct {
	URL    string `json:"url"`
	Host   string `json:"host"`
	Method string `json:"method"`
}

Request/Response mirror the payloads accepted by the e2e `driver` command, which is the container that actually issues the request from a given network namespace.

type ResolveRequest

type ResolveRequest struct {
	Server string `json:"server"`
	Name   string `json:"name"`
}

ResolveRequest/ResolveResponse mirror the payloads accepted by the driver's /resolve endpoint.

type ResolveResponse

type ResolveResponse struct {
	Rcode   string   `json:"rcode"`
	Answers []string `json:"answers,omitempty"`
	Err     string   `json:"error,omitempty"`
}

type Resolver

type Resolver struct {
	Endpoint string
}

func (Resolver) Resolve

func (res Resolver) Resolve(server, name string) (string, []string, error)

Resolve issues an A query for name against server from inside the resolver's network, returning the rcode and the A record addresses.

type Response

type Response struct {
	Status int    `json:"status"`
	Body   string `json:"body,omitempty"`
	Err    string `json:"error,omitempty"`
}

type TestService

type TestService struct {
	Name         string
	UID          string
	Port         int
	InternalIP   string
	InternalPort int
	// contains filtered or unexported fields
}

TestService is a service we register in consul to drive proxy behavior; InternalIP/InternalPort are the upstream the proxy will route to, Port is the host-side port the driver uses to reach the test backend directly.

func (*TestService) Register

func (svc *TestService) Register(client *capi.Client, tags []string, meta map[string]string) error

func (*TestService) Unregister

func (svc *TestService) Unregister(client *capi.Client) error

Directories

Path Synopsis
cmd
driver command
whoami command

Jump to

Keyboard shortcuts

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