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

A running OpenSearch server: URL getters plus the owned container. More...

#include <testcontainers/modules/OpenSearch.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 the REST port 9200.
std::string http_url () const
 The REST base URL, e.g.
Containercontainer () noexcept
 The underlying container handle: exec the in-image curl for driver-free seeding and asserts, read logs, copy files, stop() early, keep() it past the test.
const Containercontainer () const noexcept

Friends

class OpenSearchImage

Detailed Description

A running OpenSearch server: URL 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::OpenSearchContainer::host ( ) const
inlinenoexcept

The address a client in the test process connects to.

Resolved once, when the container started.

◆ port()

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

The host port published for the REST port 9200.

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

◆ http_url()

std::string testcontainers::modules::OpenSearchContainer::http_url ( ) const

The REST base URL, e.g.

http://localhost:32768 — no trailing slash, no credentials (security is disabled). Point any HTTP client or the opensearch-cpp client at it; endpoints live under /<index>/_doc, /_search, /_cluster/health, ...

◆ container() [1/2]

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

The underlying container handle: exec the in-image curl for driver-free seeding and asserts, read logs, copy files, stop() early, keep() it past the test.

◆ container() [2/2]

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

◆ OpenSearchImage

friend class OpenSearchImage
friend