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

A running single-node ScyllaDB server: contact-point getters plus the owned container. More...

#include <testcontainers/modules/ScyllaDB.hpp>

Public Member Functions

const std::string & host () const noexcept
 The address a client in the test process connects to.
std::uint16_t port () const noexcept
 The host port published for CQL port 9042.
const std::string & contact_point () const noexcept
 "<host>:<port>", e.g.
const std::string & datacenter () const noexcept
 The datacenter this node reports, e.g.
ExecResult exec_cql (const std::string &cql) const
 Run CQL through the in-container cqlsh against the node's own address — zero-dependency seeding and asserts; ';'-separated statements are fine.
Containercontainer () noexcept
 The underlying container handle: exec in-image tools (nodetool status, ...), read logs, copy files, stop() early, keep() it past the test.
const Containercontainer () const noexcept

Friends

class ScyllaDBImage

Detailed Description

A running single-node ScyllaDB server: contact-point 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).

Member Function Documentation

◆ host()

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

The address a client in the test process connects to.

Resolved once, when the container started (as are all getters here).

◆ port()

std::uint16_t testcontainers::modules::ScyllaDBContainer::port ( ) const
inlinenoexcept

The host port published for CQL port 9042.

A container restarted by hand gets fresh ephemeral ports — re-resolve via container() then.

◆ contact_point()

const std::string & testcontainers::modules::ScyllaDBContainer::contact_point ( ) const
inlinenoexcept

"<host>:<port>", e.g.

"localhost:32773", for clients that take host:port contact nodes. The cassandra.h-style APIs take the pieces instead: cass_cluster_set_contact_points(c, host().c_str()) + cass_cluster_set_port(c, port()).

◆ datacenter()

const std::string & testcontainers::modules::ScyllaDBContainer::datacenter ( ) const
inlinenoexcept

The datacenter this node reports, e.g.

"datacenter1" — what DC-aware load balancing wants: cass_cluster_set_load_balance_dc_aware(c, datacenter().c_str(), 0, cass_false).

◆ exec_cql()

ExecResult testcontainers::modules::ScyllaDBContainer::exec_cql ( const std::string & cql) const

Run CQL through the in-container cqlsh against the node's own address — zero-dependency seeding and asserts; ';'-separated statements are fine.

Output is cqlsh's aligned table — assert with substrings (e.g. "(1 rows)"), not exact matches. A failing statement is reported via the result's exit_code/stderr_data, not thrown.

◆ container() [1/2]

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

The underlying container handle: exec in-image tools (nodetool status, ...), read logs, copy files, stop() early, keep() it past the test.

◆ container() [2/2]

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

◆ ScyllaDBImage

friend class ScyllaDBImage
friend