A running ClickHouse server: endpoint getters plus the owned container.
More...
#include <testcontainers/modules/ClickHouse.hpp>
|
| const std::string & | host () const noexcept |
| | The address a client in the test process connects to.
|
| std::uint16_t | http_port () const noexcept |
| | The host port published for the HTTP port 8123.
|
| std::uint16_t | native_port () const noexcept |
| | The host port published for the native-protocol port 9000 — what clickhouse-cpp's ClientOptions and clickhouse-client --port take.
|
| const std::string & | username () const noexcept |
| const std::string & | password () const noexcept |
| const std::string & | database () const noexcept |
| std::string | connection_string () const |
| | Native-protocol DSN, clickhouse://user:password@host:native_port/database (percent-encoded) — e.g.
|
| std::string | http_url () const |
| | The HTTP base URL, e.g.
|
| ExecResult | exec_sql (const std::string &sql) const |
| | Run one SQL statement through the in-container clickhouse-client (native protocol over the container's loopback, the provisioned user, database()) — a zero-dependency seed/assert helper.
|
| Container & | container () noexcept |
| | The underlying container handle: exec clickhouse-client, read logs, copy files, stop() early, keep() it past the test.
|
| const Container & | container () const noexcept |
A running ClickHouse server: endpoint getters plus the owned container.
Move-only — it owns the core Container, whose destructor force-removes the server (RAII teardown; container().keep() or reuse opt out, see Container).
◆ host()
| const std::string & testcontainers::modules::ClickHouseContainer::host |
( |
| ) |
const |
|
inlinenoexcept |
The address a client in the test process connects to.
Resolved once, when the container started.
◆ http_port()
| std::uint16_t testcontainers::modules::ClickHouseContainer::http_port |
( |
| ) |
const |
|
inlinenoexcept |
The host port published for the HTTP port 8123.
Resolved once, when the container started; a container restarted by hand gets fresh ephemeral ports — re-resolve via container() then.
◆ native_port()
| std::uint16_t testcontainers::modules::ClickHouseContainer::native_port |
( |
| ) |
const |
|
inlinenoexcept |
The host port published for the native-protocol port 9000 — what clickhouse-cpp's ClientOptions and clickhouse-client --port take.
◆ username()
| const std::string & testcontainers::modules::ClickHouseContainer::username |
( |
| ) |
const |
|
inlinenoexcept |
◆ password()
| const std::string & testcontainers::modules::ClickHouseContainer::password |
( |
| ) |
const |
|
inlinenoexcept |
◆ database()
| const std::string & testcontainers::modules::ClickHouseContainer::database |
( |
| ) |
const |
|
inlinenoexcept |
◆ connection_string()
| std::string testcontainers::modules::ClickHouseContainer::connection_string |
( |
| ) |
const |
◆ http_url()
| std::string testcontainers::modules::ClickHouseContainer::http_url |
( |
| ) |
const |
The HTTP base URL, e.g.
http://localhost:32769. Credentials go per request (basic auth, or the X-ClickHouse-User / X-ClickHouse-Key headers); JDBC-style URLs build on the same endpoint.
◆ exec_sql()
| ExecResult testcontainers::modules::ClickHouseContainer::exec_sql |
( |
const std::string & | sql | ) |
const |
Run one SQL statement through the in-container clickhouse-client (native protocol over the container's loopback, the provisioned user, database()) — a zero-dependency seed/assert helper.
Output is TabSeparated: one row per line, columns tab-separated, no headers. A failing statement is reported via the result's exit_code/stderr_data, not thrown.
◆ container() [1/2]
| Container & testcontainers::modules::ClickHouseContainer::container |
( |
| ) |
|
|
inlinenoexcept |
The underlying container handle: exec clickhouse-client, read logs, copy files, stop() early, keep() it past the test.
◆ container() [2/2]
| const Container & testcontainers::modules::ClickHouseContainer::container |
( |
| ) |
const |
|
inlinenoexcept |
◆ ClickHouseImage
| friend class ClickHouseImage |
|
friend |