testcontainers / testcontainers/testcontainers-python

Bug: `K3SContainer` does not support other connection modes (in `get_container_host_ip`)

Open
#861 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.3k
Forks
386
Avg merge
4h 40m
Merged PRs (30d)
1

Description

Describe the bug

K3SContainer calls get_container_host_ip in its __init__ method here and here before the container is started, causing it to fail with an AssertionError here.

To Reproduce

from testcontainers.k3s import K3SContainer

with K3SContainer() as k3s:
     print("gonna throw an error before I even get here :(")

Runtime environment

I'm on an ARM Mac and this is in Python 3.12, but that shouldn't make a difference.

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 modules/k3s/testcontainers/k3s/init.py at the K3SContainer.init calls to get_container_host_ip, then inspect core/testcontainers/core/container.py around the assertion. Reproduce the provided K3SContainer context-manager example and verify that initialization no longer fails before startup and that the other connection modes are supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.