Documentation
¶
Index ¶
- Constants
- func DeleteACLConfig(client *capi.Client) error
- func ExpectHostUnreachable(drv Driver, url, host string)
- func ExpectNoRecords(res Resolver, server, name string)
- func ExpectRecords(res Resolver, server, name string, addrs ...string)
- func ExpectServiceRequest(drv Driver, url, host string, statusCode int, body string)
- func FormatCaddyConfig(endpoint string) []byte
- func GenerateUUID() string
- func NewConsulClient(addr string) (*capi.Client, error)
- func WriteACLConfig(client *capi.Client, cfg []byte) error
- func WriteCaddyConfig(client *capi.Client, cfg []byte) error
- func WriteZoneConfig(client *capi.Client) error
- type Driver
- type Request
- type ResolveRequest
- type ResolveResponse
- type Resolver
- type Response
- type TestService
Constants ¶
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 ExpectHostUnreachable ¶
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 ¶
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 ¶
ExpectRecords resolves name through res and asserts the answer contains exactly the given A record addresses, in any order.
func ExpectServiceRequest ¶
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 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 WriteZoneConfig ¶
Types ¶
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 ¶
ResolveRequest/ResolveResponse mirror the payloads accepted by the driver's /resolve endpoint.
type ResolveResponse ¶
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) Unregister ¶
func (svc *TestService) Unregister(client *capi.Client) error