Documentation
¶
Overview ¶
Package deviations loads and applies the file of accepted deviations between spec and API (FR-DEV).
Index ¶
Constants ¶
const WarnBefore = 14 * 24 * time.Hour
WarnBefore is how long before expiry an entry is reported as expiring soon (FR-DEV-05).
Variables ¶
This section is empty.
Functions ¶
func NormalizeCase ¶
NormalizeCase turns a case name copied from go test output or an IDE into the name apitest matches: without the test function ("TestAPI/"), without the position prefix of Config.NumberCases ("007_") and with spaces as "_", like Go names subtests.
Types ¶
type Entry ¶
type Entry struct {
Index int // position in the file, from 1
// Case is the case name; "*" matches within one name element.
Case string
// Expected and Actual are status codes (e.g. 404 and 200).
Expected, Actual string
// Status is a result status such as EXAMPLE_MISMATCH, for deviations
// that are not about the status code.
Status string
// Pointer limits Status to differences at exactly this JSON pointer.
Pointer string
Reason string
Ticket string
Expires time.Time
// contains filtered or unexported fields
}
Entry is one accepted deviation.
func (*Entry) ExpiresSoon ¶
ExpiresSoon reports whether the entry expires within WarnBefore.
type Outcome ¶
type Outcome struct {
Case string
Status string // e.g. FAILED
Expected string // expected status, e.g. "404"
Actual string // actual status, e.g. "200"
Pointers []string // locations of the differences, for status entries
}
Outcome describes a case result for matching.
type Set ¶
Set is a loaded deviations file.
func Load ¶
Load reads a deviations file (YAML or JSON). Invalid entries are rejected with their position (FR-DEV-02, NFR-08).