docker / docker/docker-py

Possible flakey test test_init_swarm_with_ca_config

Open
#2,291 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug
Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

https://github.com/docker/docker-py/pull/2288 initially failed with:

=================================== FAILURES ===================================
___________________ SwarmTest.test_init_swarm_with_ca_config ___________________
tests/integration/api_swarm_test.py:60: in test_init_swarm_with_ca_config
    assert self.init_swarm(swarm_spec=spec)
tests/integration/base.py:128: in init_swarm
    return self._init_swarm(self.client, **kwargs)
tests/integration/base.py:95: in _init_swarm
    '127.0.0.1', listen_addr=helpers.swarm_listen_addr(), **kwargs
docker/utils/decorators.py:34: in wrapper
    return f(self, *args, **kwargs)
docker/api/swarm.py:129: in init_swarm
    self._raise_for_status(response)
docker/api/client.py:263: in _raise_for_status
    raise create_api_error_from_http_exception(e)
docker/errors.py:31: in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
E   APIError: 503 Server Error: Service Unavailable ("Swarm is encrypted and needs to be unlocked before it can be used. Please use "docker swarm unlock" to unlock it.")

It passed on repeat.

I would hypothesise that there is perhaps a race in the test between the "swarm init" and "swarm inspect" where the init is not fully complete.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/integration/api_swarm_test.py, especially SwarmTest.test_init_swarm_with_ca_config, then inspect tests/integration/base.py around init_swarm and _init_swarm. Run the integration test repeatedly and investigate the suspected timing between swarm init and swarm inspect. Done means the test no longer fails intermittently when the swarm uses CA configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
distributed-systems, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.