The test suite leaves temp files around

Bug #476418 reported by Free Ekanayaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Landscape Client
Fix Released
Medium
Free Ekanayaka
landscape-client (Ubuntu)
Fix Released
Undecided
Unassigned
Nominated for Intrepid by Free Ekanayaka
Nominated for Jaunty by Free Ekanayaka
Nominated for Karmic by Free Ekanayaka
Nominated for Lucid by Free Ekanayaka

Bug Description

Running the Landscape Client test suite leaves temporary files in the
system temporary directory (/tmp).

This is a problem for long running machines running the suite
(e.g. buildbot slaves) that eventually run out of available file
descriptors.

 affects landscape-client
 status inprogress
 importance medium
 assignee free.ekanayaka
 milestone 1.4.1

Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

This is ready for review in the attached branch. For now I've decided to leak a bit the implementation of MockerTestCase by calling its private __cleanup method in run_isolated, because it makes the fix very simple and isolated.

So if you look at your /tmp after the test suite has run you'll notice that from the hundreds of files we had before we're down to only one, which is a pipe, probably left open by some script execution test. I'll have to investigate that further.

tags: added: fix-it-friday review
Revision history for this message
Jamu Kakar (jkakar) wrote :

[1]

+ def makePersistFile(self, *args, **kwargs):
+ """Return a temporary filename to be usued by a L{Persist} object.

s/usued/used/

[2]

+ The possible .old persist file is cleaned up after the test..

s/.././

[3]

[ERROR]: landscape.manager.tests.test_scriptexecution.RunScriptTests.test_restore_umask_in_event_of_error

Traceback (most recent call last):
  File "/home/jkakar/src/free/landscape-client/cleanup-test-files/landscape/tests/mocker.py", line 102, in test_method_wrapper
    result = test_method()
  File "/home/jkakar/src/free/landscape-client/cleanup-test-files/landscape/manager/tests/test_scriptexecution.py", line 138, in test_restore_umask_in_event_of_error
    self.assertFalse(os.path.exists(filename))
exceptions.NameError: global name 'filename' is not defined

[4]

             return result.addBoth(
- self._remove_script, filename, attachment_dir, old_umask)
+ remove_script_cb, filename, attachment_dir, old_umask)
         except:
- os.umask(old_umask)
+ self._remove_script(filename, None, old_umask)
             raise

Thomas already mentioned it, but just to capture it, the duplication
here should be removed.

+1 if all the tests pass. :)

Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Thanks Jamu!

[1] to [4]

Fixed.

Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Got a verbal +1 from Thomas, committed in r161.

Changed in landscape-client:
status: In Progress → Fix Committed
tags: removed: review
tags: added: needs-testing
tags: removed: needs-testing
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This was released already for the mentioned distros.

Changed in landscape-client (Ubuntu):
status: New → Fix Released
David Britton (dpb)
Changed in landscape-client:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.