Documentation
¶
Overview ¶
Package fake provides in-process stand-ins for external services that the acceptance and chaos drivers need: an ntfy server that records messages and an HTTP monitor target that can be switched between healthy and failing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
At time.Time
Path string
Title string
Priority string
Tags string
Body string
}
Message is one notification that Shoutrrr's ntfy service posted.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder is an in-process stand-in for an ntfy server. It accepts POST /<topic> as Shoutrrr's ntfy service sends it (plain-text body, Title, Priority and Tags headers) and records every message with its arrival time.
func NewRecorder ¶
func NewRecorder() *Recorder
NewRecorder returns an empty recorder that stamps messages with time.Now.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an HTTP server on a host port, started in the background.
type Target ¶
type Target struct {
// contains filtered or unexported fields
}
Target is the HTTP monitor target. It answers 200 OK while healthy and 503 Service Unavailable while failing. A 503 is deterministic and keeps the listener open, so the node sees a clean HTTP error instead of a connection error. Every request is counted per path.
func (*Target) ServeHTTP ¶
func (t *Target) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.
func (*Target) SetFailing ¶
SetFailing switches between 503 (true) and 200 (false).