Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Cannot test apps with hyphens in name #668

Open
paetling opened this issue Apr 4, 2016 · 0 comments
Open

Cannot test apps with hyphens in name #668

paetling opened this issue Apr 4, 2016 · 0 comments

Comments

@paetling
Copy link
Contributor

paetling commented Apr 4, 2016

I set up an app yml spec with the name penalty-box.yml. I added a test and attempted to run dusty test penalty-box unit and got back this response:

Killing testing container testpenalty-boxunit_penalty-box_1
Traceback (most recent call last):
  File "/Users/paetling/dusty_venv/bin/dusty", line 9, in <module>
    load_entry_point('dusty==0.0.1', 'console_scripts', 'dusty')()
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/dusty-0.0.1-py2.7.egg/dusty/cli/__init__.py", line 161, in main
    errored = _run_payload(payload)
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/dusty-0.0.1-py2.7.egg/dusty/cli/__init__.py", line 129, in _run_payload
    payload.run()
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/dusty-0.0.1-py2.7.egg/dusty/payload.py", line 21, in run
    self.fn(*self.args, **self.kwargs)
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/dusty-0.0.1-py2.7.egg/dusty/commands/test.py", line 98, in run_one_suite
    exit_code = _run_tests_with_image(app_or_lib_name, suite_name, test_arguments)
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/dusty-0.0.1-py2.7.egg/dusty/commands/test.py", line 219, in _run_tests_with_image
    for line in client.logs(test_container_name, stdout=True, stderr=True, stream=True):
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/docker_py-1.7.0-py2.7.egg/docker/utils/decorators.py", line 21, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/docker_py-1.7.0-py2.7.egg/docker/api/container.py", line 220, in logs
    return self._get_result(container, stream, res)
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/docker_py-1.7.0-py2.7.egg/docker/client.py", line 296, in _get_result
    cont = self.inspect_container(container)
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/docker_py-1.7.0-py2.7.egg/docker/utils/decorators.py", line 21, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/docker_py-1.7.0-py2.7.egg/docker/api/container.py", line 181, in inspect_container
    self._get(self._url("/containers/{0}/json", container)), True
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/docker_py-1.7.0-py2.7.egg/docker/client.py", line 150, in _result
    self._raise_for_status(response)
  File "/Users/paetling/dusty_venv/lib/python2.7/site-packages/docker_py-1.7.0-py2.7.egg/docker/client.py", line 145, in _raise_for_status
    raise errors.NotFound(e, response, explanation=explanation)
docker.errors.NotFound: 404 Client Error: Not Found ("No such container: testpenalty-boxunit_penalty-box_1")

The actual container's name is: testpenaltyboxunit_penalty-box_1. Note the difference in the hyphen in the first penalty-box in the test case.

I believe the issues arrises because of a mismatch between Dusty's assumptions on how docker-compose package names work and how it actually works in Docker Compose. If you look in dusty/dusty/commands/test.py at the _compose_project_name function, you see that dusty just concats the service name and suite name to get the project name. It seems that when a project name is passed with -, Docker compose just emits the hyphen. The same emitting happens if you replace the - with an _. For now I have just changed the app name to not have hyphens or underscores, but Dusty should handle this in a smarter way.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant