package kube

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Kube_test.TransportSource

Sourcetype request = {
  1. meth : Kube.Http.meth;
  2. target : string;
  3. headers : (string * string) list;
  4. body : string option;
  5. streaming : bool;
  6. max_body_bytes : int option;
}

A captured request after authentication and before HTTP framing.

Sourcetype outcome
Sourceval respond : ?status:int -> ?reason:string -> ?headers:(string * string) list -> string -> outcome

Return one buffered response body. When the client requested streaming, a successful body is delivered as one callback chunk.

Sourceval respond_json : ?status:int -> ?reason:string -> ?headers:(string * string) list -> Yojson.Safe.t -> outcome
Sourceval stream : ?status:int -> ?reason:string -> ?headers:(string * string) list -> ?wait_for_cancel:bool -> string list -> outcome

Deliver distinct chunks in order. wait_for_cancel keeps the request open after the chunks and is useful for reflectors and controller tests. It requires the client request to carry a cancellation token.

Sourceval fail : string -> outcome

Return a transport failure rather than an HTTP response.

Sourcetype t
Sourceval create : (request -> outcome) -> t

Create a concurrent handler transport. The handler may be called from several threads and is responsible for synchronizing its own mutable state. Requests are captured safely by the testkit.

Sourceval scripted : outcome list -> t

Create a FIFO transport. An extra request becomes a transport failure and is reported by verify_complete.

Sourceval client_transport : t -> Kube.Client.Transport.t
Sourceval requests : t -> request list
Sourceval request_count : t -> int
Sourceval remaining : t -> int option
Sourceval is_closed : t -> bool
Sourceval verify_complete : t -> (unit, string) result

Check that a scripted transport consumed every outcome and received no extra requests. Handler transports are always complete.

Sourceval header : request -> string -> string option

Perform a case-insensitive lookup in captured request headers.