Shutdown tests unintentionally sleep for 10 seconds

Open Beginner friendly
#336 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
testing

Research direction

Start in test/functional/master/test_shutdown.py and trace self.cluster.block_until_n_slaves_dead through poll.wait_for. Check how are_slaves_dead() reports completion and how the call's result is handled. Done means the shutdown tests still cover the flaky scenario without unconditionally waiting 10 seconds, with the relevant test behavior verified.

Written by the indexing model from the issue text.

Description

bug minor

Some of the tests in test/functional/master/test_shutdown.py do this at the end of the test:

self.cluster.block_until_n_slaves_dead(2, 10)

The block_until_n_slaves_dead method does this:

def block_until_n_slaves_dead(self, num_slaves, timeout):
    ...
    def are_slaves_dead():
        are_n_slaves_dead(num_slaves)

    slaves_died_within_timeout = poll.wait_for(are_slaves_dead, timeout_seconds=timeout)
    ...

The problem is that that are_slaves_dead() function doesn't return anything (so it always returns None). That makes the poll.wait_for call always take the full 10 seconds. (There is a separate issue in that the return value from the self.cluster.block_until_n_slaves_dead(2, 10) call is not asserted on which would have also caught this issue.)

From the git history it looks like these calls were added to address a flaky test in #174, so that indicates that some amount of sleep is necessary, but not the whole 10 seconds.

Dominant language
Python
Stars
184
Forks
41
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from box/ClusterRunner

All issues in box/ClusterRunner

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.