Documentation
¶
Overview ¶
Package servertest runs the HTTP cases each behavior's generated gen/api_<method>_public_test.go lists. Each case is one request to the real handler and middleware with the job client mocked, the way the hand-written domains' handler tests run; the response is checked for its status, its body when the case gives one, and against the generated spec.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnreachable = errors.New("agent unreachable")
ErrUnreachable is the job client failing to reach any agent.
Functions ¶
func Completed ¶
Completed is host's answer carrying data, a method's output as JSON. A write's changed is read from it.
Types ¶
type Case ¶
type Case struct {
Name string
Request Request
Token Token
// Job is what the job client expects; nil expects no job, because the
// request must be refused before one is queued.
Job *Job
WantCode int
// WantBody, when set, is the JSON body, with the results in hostname
// order.
WantBody string
}
Case is one request and what the job client is asked and answers.
type Harness ¶
type Harness struct {
// contains filtered or unexported fields
}
Harness serves one behavior's generated routes.
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job is one call the job client expects and its answer.
type Token ¶
type Token int
Token is the token a case sends.
const ( // Read is a token with the built-in read role. Read Token = iota // Write is a token with the roles that change a host without admin: automation and operator. Write // NoToken sends no Authorization header. NoToken // Lacking is a token whose permissions grant nothing a behavior needs. Lacking // Admin is a token with the built-in admin role. Admin )