Documentation
¶
Index ¶
- func Exec(client *http.Client, config Config, cmd *Command) ([]byte, *http.Header, int, error)
- func Execute(t *testing.T, config Config, tests []Test)
- func InitClient() *http.Client
- func Prepare(config Config, commands []Command)
- func PrepareRequest(config Config, cmd *Command) (*http.Request, error)
- func ReadResponse(resp *http.Response) ([]byte, *http.Header, int, error)
- func WaitForServer(baseURL string) error
- type Command
- type Config
- type Headers
- type Test
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitClient ¶
func WaitForServer ¶ added in v0.4.0
WaitForServer polls baseURL/live until smoothdb answers. Any listener would not do: when the port is already taken by an unrelated process, Start() fails with a bind error while the squatter happily answers the probe, and the suite then runs against the wrong server with baffling failures. The /live body is the fingerprint — the Server header would not do, /live is registered outside the middleware that sets it.
Types ¶
type Test ¶
type Test struct {
Description string
Method string
Query string
Body string
Headers Headers
// Expected is the response body to compare against, JSON-normalized.
// An empty Expected means "no expectation" and the body is NOT checked —
// so it cannot express PostgREST's `shouldRespondWith ""`. Use
// ExpectedEmpty for that.
Expected string
// ExpectedEmpty asserts the response body is empty. Needed because many
// ported PostgREST tests expect exactly that (writes default to
// `Prefer: return=minimal`), and encoding it as `Expected: ""` silently
// degraded those tests to status-only checks.
ExpectedEmpty bool
// ExpectedBase64 says that Expected is the base64 encoding of a binary
// body (an application/octet-stream download): the body is compared to
// its decoding, byte by byte.
ExpectedBase64 bool
ExpectedHeaders map[string]string
Status int
}
We don't embed Command to simplify tests writing
Click to show internal directories.
Click to hide internal directories.