Skip to content

Fix a hanging test on Python 3#253

Merged
mgedmin merged 3 commits intomasterfrom
say-no-to-hanging-tests
Apr 27, 2019
Merged

Fix a hanging test on Python 3#253
mgedmin merged 3 commits intomasterfrom
say-no-to-hanging-tests

Conversation

@mgedmin
Copy link
Copy Markdown
Contributor

@mgedmin mgedmin commented Apr 25, 2019

I'm not entirely sure why the test is hanging, but this seems clear
enough:

  • the test setup spawns a (non-daemon) background thread that runs
    forever, or until it is told to quit by receiving a TCP packet on a
    certain port
  • the test teardown tries to tell the background thread to quit (which
    doesn't work) and waits for that to happen
  • as a result the entire test run hangs forever

This commit adds a timeout as an extra safety net so that the test run
will complete even if the clean shutdown procedure fails for some
reason.

I'm not entirely sure why the test is hanging, but this seems clear
enough:

- the test setup spawns a (non-daemon) background thread that runs
  forever, or until it is told to quit by receiving a TCP packet on a
  certain port
- the test teardown tries to tell the background thread to quit (which
  doesn't work) and waits for that to happen
- as a result the entire test run hangs forever

This commit adds a timeout as an extra safety net so that the test run
will complete even if the clean shutdown procedure fails for some
reason.
@mgedmin mgedmin mentioned this pull request Apr 25, 2019
@mgedmin
Copy link
Copy Markdown
Contributor Author

mgedmin commented Apr 25, 2019

I'm not entirely sure why the test is hanging

This is probably because telnetlib.Telnet.write() expects a byte string but receives a plain str instead. I'm sure a fix for that is waiting somewhere in the huge series of patches that comprise #210 and we'll get to it eventually, but I'd rather have a reliable test suite that doesn't hang even if bugs are present in the code.

mgedmin added 2 commits April 26, 2019 00:23
tox -e py27 -- tests/checker/test_telnet.py takes 30 seconds to
complete.  That seems excessive to me, but one thing at a time.
In cast we forget or somebody else wants to tackle this.  After all, the
assertion error + traceback shows up at the end of the test run, and
it's not immediately clear which test is to blame for it!
@mgedmin mgedmin merged commit 8489730 into master Apr 27, 2019
@mgedmin mgedmin deleted the say-no-to-hanging-tests branch April 27, 2019 18:59
@anarcat
Copy link
Copy Markdown
Contributor

anarcat commented Apr 27, 2019

hum. i thought it was either this PR or #254 but not both, did i miss something?

either way, thanks for your work :)

@mgedmin
Copy link
Copy Markdown
Contributor Author

mgedmin commented Apr 28, 2019

In the end I didn't squash #254, so all the commits that were part of #253 got merged too...

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.

2 participants