testcontainers / testcontainers/testcontainers-rs

Expose `get_host` for use without a container.

Open
#876 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.1k
Forks
197
PR merge metrics
No merged PRs in 30d

Description

When testing connectivity, we'd like to see what happens if a client starts up before a container-based service is available. For this reason, we'd like to be able to get the host name of a container before it actually starts, but the only way to get the host name (AFAICT) is through the get_host method of active containers.

I propose adding a new public function containers_host_name, with roughly the implementation:

pub async fn containers_host_name()->Result<Host>{
  Client::lazy_client().await?
    .docker_hostname().await
    .map_err(Into::into)
}

That will allow users to know the host names of containers before they start up.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ContainerAsync::get_host and the Client::lazy_client and docker_hostname entry points referenced in the issue, then trace how Host and public functions are exported. Done means a public async containers_host_name function can return the Docker host before a container starts; add coverage alongside the existing API tests if the project provides a nearby location.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, rust
Domain
devops, testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.