Skip to content

Make volumes_from and net containers first class dependencies#1076

Merged
aanand merged 1 commit intodocker:masterfrom
gilclark:master
Mar 13, 2015
Merged

Make volumes_from and net containers first class dependencies#1076
aanand merged 1 commit intodocker:masterfrom
gilclark:master

Conversation

@gilclark
Copy link

@gilclark gilclark commented Mar 6, 2015

Make volumes_from and net containers first class dependencies and assure that starting order is correct. Added supporting unit and integration tests as well.

Signed-off-by: Gil Clark gilclark1@gmail.com

assure that starting order is correct.  Added supporting unit and
integration tests as well.

Signed-off-by: Gil Clark <gilclark1@gmail.com>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any of these tests fail the containers won't get killed or removed, which I guess is also a problem with many of the existing tests.

We should probably add

def setUp(self):
    self.cleanup_projects = []

def tearDown(self):
    for project in self.cleanup_projects:
        project.kill()
        project.remove_stopped()

And in each test case that uses this, add the project to the list immediately after creating it.

project = ...
self.cleanup_projects.append(project)

@dnephin
Copy link

dnephin commented Mar 7, 2015

LGTM

One issue with testing, which is actually a problem with many of the tests we have in that module already, so I guess it's not critical that it gets fixed in this branch.

@gilclark
Copy link
Author

gilclark commented Mar 8, 2015

I did notice that. I have to clean up a lot of containers after the tests. I did worry that containers that aren't cleaned up would pollute and fail the following tests or a rerun of the same tests but I've never seen that happen.

@aanand
Copy link

aanand commented Mar 13, 2015

Looks like the build passes: https://app.wercker.com/#build/54fa1d90d56c0f8a1d034e24

LGTM

aanand added a commit that referenced this pull request Mar 13, 2015
Make volumes_from and net containers first class dependencies
@aanand aanand merged commit 25c70c2 into docker:master Mar 13, 2015
@aanand
Copy link

aanand commented Mar 13, 2015

Hmm, build passes on Wercker but I get this locally:

root@fe9c09f96e85:/code# nosetests tests/integration/project_test.py:ProjectTest.test_project_up_starts_depends
E
======================================================================
ERROR: test_project_up_starts_depends (tests.integration.project_test.ProjectTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/code/tests/integration/project_test.py", line 289, in test_project_up_starts_depends
    project.up(['web'])
  File "/code/compose/project.py", line 219, in up
    do_build=do_build):
  File "/code/compose/service.py", line 211, in recreate_containers
    self.start_container(container)
  File "/code/compose/service.py", line 291, in start_container
    cap_drop=cap_drop,
  File "/code/compose/container.py", line 121, in start
    return self.client.start(self.id, **options)
  File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 867, in start
    self._raise_for_status(res)
  File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 95, in _raise_for_status
    raise errors.APIError(e, response, explanation=explanation)
APIError: 500 Server Error: Internal Server Error ("Cannot start container b817511fdbb57bfc18c0fb5f237ca6018c2c97bda5688a6dd1da0f35d6e45488: parent IP '' is invalid")
-------------------- >> begin captured logging << --------------------
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/images/json?only_ids=0&all=0 HTTP/1.1" 200 None
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=0&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 216
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
compose.service: INFO: Creating composetest_net_1...
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
requests.packages.urllib3.connectionpool: DEBUG: "POST /run/docker.sock/v1.14/containers/create?name=composetest_net_1 HTTP/1.1" 201 90
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/ef2d4d3e6af45e77d5beb6a29375a266828216b81c019498633a5ad565d15130/json HTTP/1.1" 200 1763
requests.packages.urllib3.connectionpool: DEBUG: "POST /run/docker.sock/v1.14/containers/ef2d4d3e6af45e77d5beb6a29375a266828216b81c019498633a5ad565d15130/start HTTP/1.1" 204 0
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
compose.service: INFO: Creating composetest_app_1...
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
requests.packages.urllib3.connectionpool: DEBUG: "POST /run/docker.sock/v1.14/containers/create?name=composetest_app_1 HTTP/1.1" 201 90
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/c78cd7eafa1ef3ca4b480894f0ae5e4f8d7d3135f190991a5e95ec6b6681d0ad/json HTTP/1.1" 200 1763
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=0&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 450
requests.packages.urllib3.connectionpool: DEBUG: "POST /run/docker.sock/v1.14/containers/c78cd7eafa1ef3ca4b480894f0ae5e4f8d7d3135f190991a5e95ec6b6681d0ad/start HTTP/1.1" 204 0
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
compose.service: INFO: Creating composetest_web_1...
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=1&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 None
requests.packages.urllib3.connectionpool: DEBUG: "POST /run/docker.sock/v1.14/containers/create?name=composetest_web_1 HTTP/1.1" 201 90
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/b817511fdbb57bfc18c0fb5f237ca6018c2c97bda5688a6dd1da0f35d6e45488/json HTTP/1.1" 200 1763
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=0&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 684
requests.packages.urllib3.connectionpool: DEBUG: "GET /run/docker.sock/v1.14/containers/json?all=0&limit=-1&trunc_cmd=1&size=0 HTTP/1.1" 200 684
requests.packages.urllib3.connectionpool: DEBUG: "POST /run/docker.sock/v1.14/containers/b817511fdbb57bfc18c0fb5f237ca6018c2c97bda5688a6dd1da0f35d6e45488/start HTTP/1.1" 500 113
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 1 test in 1.873s

FAILED (errors=1)

@dnephin
Copy link

dnephin commented Mar 13, 2015

I think this might be related moby/moby#9340

Seems like there is some condition where links can cause net:container to fail. Maybe we should remove links from that test for now?

@aanand
Copy link

aanand commented Mar 13, 2015

Yep. See #1108.

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.

3 participants