Documentation
¶
Overview ¶
Package wasmtest holds test helpers for the WASM plugin host: a fake crates.io API with synthetic data, used by the host's tests and by benchmark 4 (bench/wasm).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CratesUpstream ¶
type CratesUpstream struct {
// contains filtered or unexported fields
}
CratesUpstream is a fake crates.io API serving GET /api/v1/crates/{name}/versions with seek pagination (meta.next_page = "?per_page=N&seek=K"), an ETag per page and 304s on If-None-Match. All data is synthetic.
func NewCratesUpstream ¶
func NewCratesUpstream(pageSize int, crates map[string]int) *CratesUpstream
NewCratesUpstream serves the given crates, each with n versions "1.0.<n-1>" … "1.0.0" (newest first), pageSize versions per page.
func (*CratesUpstream) Authorizations ¶
func (u *CratesUpstream) Authorizations() []string
Authorizations returns the Authorization header of every request so far.
func (*CratesUpstream) Change ¶
func (u *CratesUpstream) Change()
Change publishes one more version of every crate, which changes every ETag.
func (*CratesUpstream) Requests ¶
func (u *CratesUpstream) Requests() int
Requests returns the number of requests served.
func (*CratesUpstream) ServeHTTP ¶
func (u *CratesUpstream) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.