Testcontainers.HttpWaitStrategy (testcontainers v2.1.0)

Copy Markdown View Source

Considers the container as ready when a http request is successful.

Summary

Types

t()

The HttpWaitStrategy struct

Functions

Creates a new HttpWaitStrategy to wait until a http requests succeeds.

Types

t()

@type t() :: %Testcontainers.HttpWaitStrategy{
  endpoint: String.t(),
  headers: [{binary(), binary()}],
  match: (map() -> boolean()),
  max_retries: term(),
  method: :get | :post | :patch | :put | :delete | :head | :options | :trace,
  port: integer(),
  protocol: String.t(),
  status_code: integer(),
  timeout: integer()
}

The HttpWaitStrategy struct

Options

  • :endpoint - The endpoint to request

  • :port - The exposed port of your container

Verification Options:

  • :status_code - Check if the request responds with the given status code

  • :match - Run your custom matcher on the given response. A 1-arity function taking a response as first parameter and must return a boolean

Request Options:

  • :protocol - which protocol to use, defaults to http

  • :method - the request method, one of [:head, :get, :delete, :trace, :options, :post, :put, :patch]

  • :timeout - The timeout of the request (in milliseconds), defaults to 5000

  • :headers - Apply any headers to your request

Functions

new(endpoint, port, options \\ [])

Creates a new HttpWaitStrategy to wait until a http requests succeeds.