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

A running MinIO server: S3 endpoint getters plus the owned container. More...

#include <testcontainers/modules/MinIO.hpp>

Public Member Functions

const std::string & host () const noexcept
 The address a client in the test process connects to.
std::uint16_t s3_port () const noexcept
 The host port published for the S3 API port 9000.
std::uint16_t console_port () const noexcept
 The host port published for the web console (container port 9001).
const std::string & access_key () const noexcept
 The root access key — what an S3 client sends as the access key ID (AWS_ACCESS_KEY_ID).
const std::string & secret_key () const noexcept
 The matching secret key (AWS_SECRET_ACCESS_KEY).
std::string s3_url () const
 The S3 endpoint for clients in THIS process, e.g.
std::string console_url () const
 The web-console URL, e.g.
Containercontainer () noexcept
 The underlying container handle: exec the in-image mc (after a with_bucket start it is already aliased to the server as tc), read logs, copy files, stop() early, keep() it past the test.
const Containercontainer () const noexcept

Friends

class MinIOImage

Detailed Description

A running MinIO server: S3 endpoint getters plus the owned container.

Move-only — it owns the core Container, whose destructor force-removes the server including the image's anonymous /data volume (RAII teardown; container().keep() or reuse opt out, see Container).

Member Function Documentation

◆ host()

const std::string & testcontainers::modules::MinIOContainer::host ( ) const
inlinenoexcept

The address a client in the test process connects to.

Resolved once, when the container started.

◆ s3_port()

std::uint16_t testcontainers::modules::MinIOContainer::s3_port ( ) const
inlinenoexcept

The host port published for the S3 API port 9000.

Resolved once, when the container started; a container restarted by hand gets fresh ephemeral ports — re-resolve via container() then.

◆ console_port()

std::uint16_t testcontainers::modules::MinIOContainer::console_port ( ) const
inlinenoexcept

The host port published for the web console (container port 9001).

◆ access_key()

const std::string & testcontainers::modules::MinIOContainer::access_key ( ) const
inlinenoexcept

The root access key — what an S3 client sends as the access key ID (AWS_ACCESS_KEY_ID).

◆ secret_key()

const std::string & testcontainers::modules::MinIOContainer::secret_key ( ) const
inlinenoexcept

The matching secret key (AWS_SECRET_ACCESS_KEY).

◆ s3_url()

std::string testcontainers::modules::MinIOContainer::s3_url ( ) const

The S3 endpoint for clients in THIS process, e.g.

http://localhost:32768 — plain HTTP, no trailing slash. Use it as an endpoint override with PATH-STYLE addressing (the bucket rides in the URL path, not the hostname — virtual-host style needs wildcard DNS a test container does not have): AWS SDK for C++ — set endpointOverride = s3_url() on the client config and construct the S3Client with useVirtualAddressing = false (any region works; "us-east-1" for SDKs that insist on one).

◆ console_url()

std::string testcontainers::modules::MinIOContainer::console_url ( ) const

The web-console URL, e.g.

http://localhost:32769 — log in with access_key()/secret_key() (pairs well with container().keep() after a failed test). At the pinned release the community console is an object BROWSER only (administration moved to mc); with MINIO_BROWSER=off nothing listens here.

◆ container() [1/2]

Container & testcontainers::modules::MinIOContainer::container ( )
inlinenoexcept

The underlying container handle: exec the in-image mc (after a with_bucket start it is already aliased to the server as tc), read logs, copy files, stop() early, keep() it past the test.

◆ container() [2/2]

const Container & testcontainers::modules::MinIOContainer::container ( ) const
inlinenoexcept

◆ MinIOImage

friend class MinIOImage
friend