Change in vdsm[master]: Introduce VolumeArtifacts

nsoffer at redhat.com nsoffer at redhat.com
Wed Mar 30 13:09:43 UTC 2016


Nir Soffer has posted comments on this change.

Change subject: Introduce VolumeArtifacts
......................................................................


Patch Set 25:

(4 comments)

I like the tests, not sure they are complete but they make it very clear that is this class and how it should behave.

https://gerrit.ovirt.org/#/c/48097/25/tests/volume_artifacts_test.py
File tests/volume_artifacts_test.py:

Line 28: 
Line 29: from storage import fileVolume, image, sd, volume
Line 30: 
Line 31: 
Line 32: class ValidationError(Exception):
We don't need this, we should raise AssertionError for test failures. Raising this will be considered as test error instead of test failure.
Line 33:     pass
Line 34: 
Line 35: 
Line 36: class ExpectedFailure(Exception):


Line 212:             artifacts.vol_id + fileVolume.LEASE_FILEEXT)
Line 213:         self.assertIn(leasefile, dirlist)
Line 214: 
Line 215:     def validate_artifacts(self, artifacts):
Line 216:         lease_path = artifacts.volume_path + fileVolume.LEASE_FILEEXT
Lets add an accessor for the lease file path to the class, like meta_volatile_path
Line 217:         for f in [artifacts.meta_volatile_path, artifacts.volume_path,
Line 218:                   lease_path]:
Line 219:             if not os.path.exists(f):
Line 220:                 self.log.debug("Artifact missing: %s", f)


Line 217:         for f in [artifacts.meta_volatile_path, artifacts.volume_path,
Line 218:                   lease_path]:
Line 219:             if not os.path.exists(f):
Line 220:                 self.log.debug("Artifact missing: %s", f)
Line 221:                 raise ValidationError()
AssertionError would make the test fail nicely like any other test failure.
Line 222: 
Line 223:     def failure(*args):
Line 224:         raise ExpectedFailure()
Line 225: 


Line 230:         self.img_id = str(uuid.uuid4())
Line 231:         self.vol_id = str(uuid.uuid4())
Line 232: 
Line 233:     def test_getallimages(self):
Line 234:         # The current behavior of getAllInages is to report garbage image
getAllImages (n -> m)
Line 235:         # directories (perhaps this should be changed).
Line 236:         with fake_file_env() as env:
Line 237:             garbage_img_id = sd.REMOVED_IMAGE_PREFIX + self.img_id
Line 238:             self.assertEqual(set(), env.sd_manifest.getAllImages())


-- 
To view, visit https://gerrit.ovirt.org/48097
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I352423e39a899b9b83ccf3b8f6c17ec433e9c353
Gerrit-PatchSet: 25
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Ala Hino <ahino at redhat.com>
Gerrit-Reviewer: Amit Aviram <aaviram at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Freddy Rolland <frolland at redhat.com>
Gerrit-Reviewer: Greg Padgett <gpadgett at redhat.com>
Gerrit-Reviewer: Idan Shaby <ishaby at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Liron Aravot <laravot at redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: Vered Volansky <vvolansk at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list