Skip to content
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

intermittent test_cleanup_containers() failing #262

Open
jpopelka opened this issue Aug 14, 2018 · 2 comments
Open

intermittent test_cleanup_containers() failing #262

jpopelka opened this issue Aug 14, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@jpopelka
Copy link
Member

For example here:

11:47:45 =================================== FAILURES ===================================
11:47:45 ___________________________ test_cleanup_containers ____________________________
11:47:45 
11:47:45     def test_cleanup_containers():
11:47:45         with DockerBackend(logging_level=logging.DEBUG, cleanup=[CleanupPolicy.CONTAINERS]) as backend:
11:47:45             # cleaning up from previous runs
11:47:45             backend.cleanup_containers()
11:47:45     
11:47:45             client = get_client()
11:47:45             container_sum = len(client.containers(all=True))
11:47:45             image = DockerImage(FEDORA_MINIMAL_REPOSITORY, tag=FEDORA_MINIMAL_REPOSITORY_TAG)
11:47:45             command = ["ls"]
11:47:45             additional_opts = ["-i", "-t"]
11:47:45     
11:47:45             for i in range(3):
11:47:45                 image.run_via_binary(command=command, additional_opts=additional_opts)
11:47:45     
11:47:45 >           assert container_sum+3 == len(client.containers(all=True))
11:47:45 E           AssertionError: assert (23 + 3) == 25
11:47:45 E            +  where 25 = len([{'Command': 'ls', 'Created': 1534247099, 'HostConfig': {'NetworkMode': 'default'}, 'Id': '2b19224e1131020e63846d3943a...tConfig': {'NetworkMode': 'host'}, 'Id': 'd6f4675524701350b1697c9d32967d29e3e80723dbfb6f1e5431977cb9777c11', ...}, ...])
11:47:45 E            +    where [{'Command': 'ls', 'Created': 1534247099, 'HostConfig': {'NetworkMode': 'default'}, 'Id': '2b19224e1131020e63846d3943a...tConfig': {'NetworkMode': 'host'}, 'Id': 'd6f4675524701350b1697c9d32967d29e3e80723dbfb6f1e5431977cb9777c11', ...}, ...] = <bound method APIClient.containers of <docker.api.client.APIClient object at 0x7f197f853fd0>>(all=True)
11:47:45 E            +      where <bound method APIClient.containers of <docker.api.client.APIClient object at 0x7f197f853fd0>> = <docker.api.client.APIClient object at 0x7f197f853fd0>.containers
11:47:45 
11:47:45 tests/integration/test_backend.py:41: AssertionError
@TomasTomecek
Copy link
Member

I suspect this is a race: 2 concurrent test runs affect each other.

My proposal: short term - remove the assert with precise numbers, long term - enable numbers back and allow concurrent test runs (I feel like this will require changes to cleanup mechanism). Over.

@TomasTomecek TomasTomecek added the bug Something isn't working label Aug 14, 2018
jpopelka added a commit to jpopelka/conu that referenced this issue Aug 21, 2018
@dhodovsk
Copy link
Member

dhodovsk commented Sep 11, 2018

Add unique identifier for conu LABEL in every instance of DockerBackend.

Or store all created containers in a list. Similarly as in https://github.com/user-cont/conu/blob/master/conu/backend/k8s/backend.py#L62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants