testcontainers / testcontainers/testcontainers-python
Bug: `K3SContainer` does not support other connection modes (in `get_container_host_ip`)
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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