exasol / integration-test-docker-environment

A docker-based environment for integration tests with the EXASOL DB.
https://exasol.github.io/integration-test-docker-environment/
MIT License
6 stars 2 forks source link

Improve error message when docker socket can't be found #17

Closed SimonDudanski closed 2 years ago

SimonDudanski commented 4 years ago
291       File "/builds/Dudanski/exasol-testautomatisierung/integration-test-docker-environment/src/lib/test_environment/prepare_network_for_test_environment.py", line 27, in run_task
292         self.network_info = self.create_docker_network()
293       File "/builds/Dudanski/exasol-testautomatisierung/integration-test-docker-environment/src/lib/test_environment/prepare_network_for_test_environment.py", line 37, in create_docker_network
294         self.remove_container(self.test_container_name)
295       File "/builds/Dudanski/exasol-testautomatisierung/integration-test-docker-environment/src/lib/test_environment/prepare_network_for_test_environment.py", line 72, in remove_container
296         container = self._client.containers.get(container_name)
297       File "/venv/lib/python3.6/site-packages/docker/models/containers.py", line 880, in get
298         resp = self.client.api.inspect_container(container_id)
299       File "/venv/lib/python3.6/site-packages/docker/utils/decorators.py", line 19, in wrapped
300         return f(self, resource_id, *args, **kwargs)
301       File "/venv/lib/python3.6/site-packages/docker/api/container.py", line 758, in inspect_container
302         self._get(self._url("/containers/{0}/json", container)), True
303       File "/venv/lib/python3.6/site-packages/docker/utils/decorators.py", line 46, in inner
304         return f(self, *args, **kwargs)
305       File "/venv/lib/python3.6/site-packages/docker/api/client.py", line 230, in _get
306         return self.get(url, **self._set_request_timeout(kwargs))
307       File "/venv/lib/python3.6/site-packages/requests/sessions.py", line 543, in get
308         return self.request('GET', url, **kwargs)
309       File "/venv/lib/python3.6/site-packages/requests/sessions.py", line 530, in request
310         resp = self.send(prep, **send_kwargs)
311       File "/venv/lib/python3.6/site-packages/requests/sessions.py", line 643, in send
312         r = adapter.send(request, **kwargs)
313       File "/venv/lib/python3.6/site-packages/requests/adapters.py", line 498, in send
314         raise ConnectionError(err, request=request)
315     requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
tkilias commented 4 years ago

Situation:

Currently, we don't check if docker is available on the machine and only recognize the problem deep inside the stack trace with a not so useful error message.

Fix:

Check if we can connect to the Docker daemon very early in the process and if we can't reach throw a useful error message.