Skip to content

tests: isolate FromContextTest from ambient TLS env vars - #3431

Open
ricardobranco777 wants to merge 1 commit into
docker:mainfrom
ricardobranco777:dockertls
Open

tests: isolate FromContextTest from ambient TLS env vars#3431
ricardobranco777 wants to merge 1 commit into
docker:mainfrom
ricardobranco777:dockertls

Conversation

@ricardobranco777

@ricardobranco777 ricardobranco777 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

DOCKER_TLS_VERIFY/DOCKER_CERT_PATH leaking from the host running the tests (e.g. openQA) broke from_env()'s base_url scheme and caused TLSParameterError. Pop both in setUp alongside DOCKER_HOST, etc.

Otherwise tests fail on openQA:
https://openqa.opensuse.org/tests/6180415

# Test messages # test_from_env_docker_host_overrides_context
# failure: 

AssertionError: assert 'https://192.168.59.103:2375' == 'http://192.168.59.103:2375'
  
  - http://192.168.59.103:2375
  + https://192.168.59.103:2375
  ?     +
tests/unit/client_test.py:302: in test_from_env_docker_host_overrides_context
    assert client.api.base_url == 'http://192.168.59.103:2375'
E   AssertionError: assert 'https://192.168.59.103:2375' == 'http://192.168.59.103:2375'
E     
E     - http://192.168.59.103:2375
E     + https://192.168.59.103:2375
E     ?     +
# Test messages # test_from_env_use_context_false_skips_context
# failure: 

docker.errors.TLSParameterError: If using TLS, the base_url argument must be provided.. TLS configurations should map the Docker CLI client configurations. See https://docs.docker.com/engine/articles/https/ for API details.
tests/unit/client_test.py:308: in test_from_env_use_context_false_skips_context
    client = docker.from_env(
docker/client.py:110: in from_env
    return cls(
docker/client.py:48: in __init__
    self.api = APIClient(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
docker/api/client.py:123: in __init__
    raise TLSParameterError(
E   docker.errors.TLSParameterError: If using TLS, the base_url argument must be provided.. TLS configurations should map the Docker CLI client configurations. See https://docs.docker.com/engine/articles/https/ for API details.

DOCKER_TLS_VERIFY/DOCKER_CERT_PATH leaking from the host running the
tests (e.g. openQA) broke from_env()'s base_url scheme and caused
TLSParameterError. Pop both in setUp alongside DOCKER_HOST, etc.

Signed-off-by: Ricardo Branco <rbranco@suse.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant