Change in vdsm[master]: storage.misc: subclass DeferableContext for easy undoing

zhshzhou at linux.vnet.ibm.com zhshzhou at linux.vnet.ibm.com
Tue Nov 13 05:38:50 UTC 2012


Zhou Zheng Sheng has posted comments on this change.

Change subject: storage.misc: subclass DeferableContext for easy undoing
......................................................................


Patch Set 4: (2 inline comments)

Thanks ShaoHe. I will update the patch according to your suggestions.

....................................................
File tests/rollbackContextTests.py
Line 62:                 self.tempfiles(10, UndoError, rollback)
Line 63: 
Line 64:         self.assertRaises(UndoError, exceptionInUndo)
Line 65:         # Directory and files should be removed
Line 66:         self.assertEquals(glob.glob(self.tmpdirPrefix + "*"), [])
It does not list the subdir because the subdir is deleted in the undo actions. You have to run a debugger and let it pause before it gets out of the "with" statement to see that dir listed.

I use glob to check if the dir is deleted because in previous patch set, I raise an exception before tempfiles() returns, so the caller does not know the exact path of the temp dir. Now I raise exception in undo actions, so we can get the path always, I can check its existence directly now.
Line 67: 
Line 68:     def testExceptionUnderContext(self):
Line 69:         def exceptionUnderContext():
Line 70:             with RollbackContext() as rollback:


Line 82:             for i in range(0, fileCount):
Line 83:                 with open(os.path.join(dirPath, str(i)), "rb") as f:
Line 84:                     self.assertEquals(int(f.read()), i)
Line 85:         # Directory and files should be removed
Line 86:         self.assertEquals(glob.glob(self.tmpdirPrefix + "*"), [])
It seems like you want some tests to verify the exception we caught is the FIRST one. I can pass an index to the exception __init__() methoed, then check if the index is the first one passed.


--
To view, visit http://gerrit.ovirt.org/8671
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibc932637dd81c3becf92de34ea647c1cea136111
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Royce Lv <lvroyce at linux.vnet.ibm.com>
Gerrit-Reviewer: Ryan Harper <ryanh at us.ibm.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>


More information about the vdsm-patches mailing list