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

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

#include <testcontainers/modules/RustFS.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 S3 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 in-image tools (the image ships curl and a shell), read logs, copy files, stop() early, keep() it past the test.
const Containercontainer () const noexcept

Friends

class RustFSImage

Detailed Description

A running RustFS 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::RustFSContainer::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::RustFSContainer::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::RustFSContainer::console_port ( ) const
inlinenoexcept

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

◆ access_key()

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

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

◆ secret_key()

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

The matching secret key (AWS_SECRET_ACCESS_KEY).

◆ s3_url()

std::string testcontainers::modules::RustFSContainer::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::RustFSContainer::console_url ( ) const

The web-console URL, e.g.

http://localhost:32769/rustfs/console/ — the UI lives under that path (the console port answers 403 at /); log in with access_key()/secret_key() (pairs well with container().keep() after a failed test). If the console was disabled via with_env("RUSTFS_CONSOLE_ENABLE", "false"), the port is still published but nothing answers.

◆ container() [1/2]

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

The underlying container handle: exec in-image tools (the image ships curl and a shell), read logs, copy files, stop() early, keep() it past the test.

◆ container() [2/2]

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

◆ RustFSImage

friend class RustFSImage
friend