testcontainers-cpp 0.2.0
Native C++20 Testcontainers over the Docker Engine API
Loading...
Searching...
No Matches
testcontainers::Healthcheck Class Reference

A container HEALTHCHECK definition, mirroring Docker's create-body Healthcheck object. More...

#include <testcontainers/Healthcheck.hpp>

Public Member Functions

Healthcheckwith_interval (std::chrono::nanoseconds interval)
Healthcheckwith_timeout (std::chrono::nanoseconds timeout)
Healthcheckwith_retries (int retries)
Healthcheckwith_start_period (std::chrono::nanoseconds start_period)
const std::vector< std::string > & test () const noexcept
std::optional< std::chrono::nanoseconds > interval () const noexcept
std::optional< std::chrono::nanoseconds > timeout () const noexcept
std::optional< std::chrono::nanoseconds > start_period () const noexcept
std::optional< int > retries () const noexcept

Static Public Member Functions

static Healthcheck cmd_shell (std::string cmd)
 ["CMD-SHELL", cmd] — run cmd with the container's default shell.
static Healthcheck cmd (std::vector< std::string > argv)
 ["CMD", arg0, arg1, ...] — exec the given argv directly (no shell).
static Healthcheck none ()
 ["NONE"] — disable any healthcheck inherited from the image.

Detailed Description

A container HEALTHCHECK definition, mirroring Docker's create-body Healthcheck object.

The test vector follows Docker's tagged convention: the first element is the kind ("CMD", "CMD-SHELL", or "NONE") and the remaining elements are the command/arguments. Build one with the static factories, then tune it with the chainable setters (same style as GenericImage).

A plain, copyable value type (no Boost/Asio leakage).

Member Function Documentation

◆ cmd_shell()

Healthcheck testcontainers::Healthcheck::cmd_shell ( std::string cmd)
inlinestatic

["CMD-SHELL", cmd] — run cmd with the container's default shell.

◆ cmd()

Healthcheck testcontainers::Healthcheck::cmd ( std::vector< std::string > argv)
inlinestatic

["CMD", arg0, arg1, ...] — exec the given argv directly (no shell).

◆ none()

Healthcheck testcontainers::Healthcheck::none ( )
inlinestatic

["NONE"] — disable any healthcheck inherited from the image.

◆ with_interval()

Healthcheck & testcontainers::Healthcheck::with_interval ( std::chrono::nanoseconds interval)
inline

◆ with_timeout()

Healthcheck & testcontainers::Healthcheck::with_timeout ( std::chrono::nanoseconds timeout)
inline

◆ with_retries()

Healthcheck & testcontainers::Healthcheck::with_retries ( int retries)
inline

◆ with_start_period()

Healthcheck & testcontainers::Healthcheck::with_start_period ( std::chrono::nanoseconds start_period)
inline

◆ test()

const std::vector< std::string > & testcontainers::Healthcheck::test ( ) const
inlinenoexcept

◆ interval()

std::optional< std::chrono::nanoseconds > testcontainers::Healthcheck::interval ( ) const
inlinenoexcept

◆ timeout()

std::optional< std::chrono::nanoseconds > testcontainers::Healthcheck::timeout ( ) const
inlinenoexcept

◆ start_period()

std::optional< std::chrono::nanoseconds > testcontainers::Healthcheck::start_period ( ) const
inlinenoexcept

◆ retries()

std::optional< int > testcontainers::Healthcheck::retries ( ) const
inlinenoexcept