Merge lp:~jml/launchpad/sftp-poppy into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Jonathan Lange |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~jml/launchpad/sftp-poppy |
Merge into: | lp:launchpad |
Diff against target: |
485 lines (+125/-146) 8 files modified
lib/canonical/launchpad/daemons/tachandler.py (+83/-47) lib/lp/poppy/filesystem.py (+0/-1) lib/lp/poppy/tests/__init__.py (+5/-0) lib/lp/poppy/tests/helpers.py (+8/-16) lib/lp/poppy/tests/test_poppy.py (+17/-23) lib/lp/services/osutils.py (+8/-54) lib/lp/soyuz/doc/soyuz-upload.txt.disabled (+1/-1) lib/lp/testing/__init__.py (+3/-4) |
To merge this branch: | bzr merge lp:~jml/launchpad/sftp-poppy |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Approve | ||
Michael Nelson | Pending | ||
Review via email: mp+21627@code.launchpad.net |
Commit message
Add two_stage_kill, speed up tachandler and kill by pidfile. Clean up poppy tests.
Description of the change
Contrary to what you might expect, this branch actually has nothing to do with SFTP. Instead, it does a bunch of cleanups and fixes to testing code that I had to touch in order to start thinking about with Poppy.
canonical/
Use osutils.
lp/services/
Extract the two-stage kill part of osutils.
Fix a bug in the two-stage kill algorithm. If you terminate a process and don't give it the chance to report its results back to the parent process, the terminated process remains as a zombie. Without the waitpid, the polling loop will *always* run to completion and then do the SIGKILL, thus making the call take over 5s guaranteed.
Fixing this may well make some layers tear down faster.
lp/poppy/
Remove flakes.
lp/poppy/
lp/poppy/
Move all of the helper code out of __init__ and into helpers.py. Add a stub __init__.py.
Fix up some of the formatting in helpers, and re-use two_stage_kill, getting rid of the slow (wait for 2s) two-stage kill implementation here.
lp/poppy/
Bits and pieces of cleanup:
* Use lp.testing.TestCase
* Fix some flakes
* Rename tests to test_foo from testFoo, according to the standard
* Delete the useless layer
* Fix spelling mistakes
* Use addCleanup instead of tearDown
* Use makeTemporaryDi
* Whitespace cleanups
lp/soyuz/
The return value of killPoppy isn't useful and isn't used.
lp/testing/
Avoid using lambdas in addCleanup -- this is a throwback to an old addCleanup API. Re-use makeTemporaryDi
Thanks,
jml
Looks good. Two comments:
* It's not necessary to do waitpid(pid, os.WNOHANG) followed by
kill(pid, 0); the return value from waitpid() will be (0, 0) when
the process has not exited yet, and it will error the same as kill()
if the process does not exist.
* It might be nice to be able to pass a subprocess.Popen into
two_stage_kill, so that its poll() method is used, and so the
returncode attribute is set correctly to avoid confusion. But,
really, this is probably not worth the effort.