Skip to content

Bug: Connection mode override environment variable is not honored #774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mschmitzer opened this issue Feb 17, 2025 · 1 comment · Fixed by #775 · May be fixed by #800
Closed

Bug: Connection mode override environment variable is not honored #774

mschmitzer opened this issue Feb 17, 2025 · 1 comment · Fixed by #775 · May be fixed by #800

Comments

@mschmitzer
Copy link
Contributor

Describe the bug

The testcontainers.core.config module defines a get_user_overridden_connection_mode function that reads the TESTCONTAINERS_CONNECTION_MODE environment variable. This looks as though it should be used to initialize the connection_mode_override member of the testcontainers_config object, but is actually unused.

I guess this might be intentional, but it would seem useful to be able to easily control the connection mode from the environment.

To Reproduce

import os
os.environ["TESTCONTAINERS_CONNECTION_MODE"] = "bridge_ip"
import testcontainers.core.config as config
assert config.testcontainers_config.connection_mode_override == config.ConnectionMode.bridge_ip

Runtime environment

$ uname -a
Linux *** 6.8.0-52-generic #53-Ubuntu SMP PREEMPT_DYNAMIC Sat Jan 11 00:06:25 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
$ python --version
Python 3.9.2
$ pip freeze
certifi==2025.1.31
charset-normalizer==3.4.1
docker==7.1.0
idna==3.10
python-dotenv==1.0.1
requests==2.32.3
testcontainers==4.9.1
typing_extensions==4.12.2
urllib3==2.3.0
wrapt==1.17.2
@alexanderankin
Copy link
Member

this one is pretty silly! fix incoming as soon as someone approves my PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants