|
testcontainers-cpp 0.2.0
Native C++20 Testcontainers over the Docker Engine API
|
A daemon-side restart policy (HostConfig.RestartPolicy): when the container exits, the daemon itself restarts it. More...
#include <testcontainers/RestartPolicy.hpp>
Static Public Member Functions | |
| static RestartPolicy | always () |
| Restart whenever the container exits, regardless of exit code. | |
| static RestartPolicy | unless_stopped () |
| Like always(), except an explicit stop (docker stop) sticks. | |
| static RestartPolicy | on_failure (int max_retries) |
| Restart only after a nonzero exit, giving up after max_retries consecutive failures (0 = no cap). | |
Public Attributes | |
| std::string | name |
| Docker's Name values: "no", "always", "unless-stopped", "on-failure". | |
| int | maximum_retry_count = 0 |
| Give-up threshold after consecutive failed restarts; only valid nonzero with "on-failure" (0 = keep retrying without a cap). | |
A daemon-side restart policy (HostConfig.RestartPolicy): when the container exits, the daemon itself restarts it.
Build one via the named factories, e.g. RestartPolicy::on_failure(3).
Two interactions worth knowing in test code: the daemon rejects a restart policy combined with auto-remove, and a restarting container is still Ryuk-reaped at process exit — always() keeps a crashing service alive DURING the test session, it does not outlive it (combine with reuse for a container that survives across runs).
|
inlinestatic |
Restart whenever the container exits, regardless of exit code.
|
inlinestatic |
Like always(), except an explicit stop (docker stop) sticks.
|
inlinestatic |
Restart only after a nonzero exit, giving up after max_retries consecutive failures (0 = no cap).
| std::string testcontainers::RestartPolicy::name |
Docker's Name values: "no", "always", "unless-stopped", "on-failure".
| int testcontainers::RestartPolicy::maximum_retry_count = 0 |
Give-up threshold after consecutive failed restarts; only valid nonzero with "on-failure" (0 = keep retrying without a cap).