Looks good, patch committed! Thanks, Tony
On 03/16/2015 01:41 AM, Gris Ge wrote: > * Splitting test test_volume_list into: > 1. test_volume_list > # Only testing lsm.Client.volumes() method. > 2. test_volume_vpd83 > # Test VPD83 information. > > Signed-off-by: Gris Ge <f...@redhat.com> > --- > test/plugin_test.py | 35 ++++++++++++++++++++++++----------- > 1 file changed, 24 insertions(+), 11 deletions(-) > > diff --git a/test/plugin_test.py b/test/plugin_test.py > index 33f28ce..1e50d6c 100755 > --- a/test/plugin_test.py > +++ b/test/plugin_test.py > @@ -323,28 +323,41 @@ def _vpd_correct(vpd): > return True > return False > > - def test_volume_list(self): > - vol = None > + def _find_or_create_volumes(self): > + """ > + Find existing volumes, if not found, try to create one. > + Return (volumes, flag_created) > + If 'flag_created' is True, then returned volumes is newly created. > + """ > volumes = self.c.volumes() > - if len(volumes) == 0: > + flag_created = False > + if len(self.c.volumes()) == 0: > for s in self.systems: > cap = self.c.capabilities(s) > - > if supported(cap, [Cap.VOLUME_CREATE, Cap.VOLUME_DELETE]): > - vol, pool = self._volume_create(s.id) > + self._volume_create(s.id) > + flag_created = True > break > + volumes = self.c.volumes() > > - volumes = self.c.volumes() > + return volumes, flag_created > + > + def test_volume_list(self): > + (volumes, flag_created) = self._find_or_create_volumes() > + self.assertTrue(len(volumes) > 0, "We need at least 1 volume to > test") > > + if flag_created: > + self._volume_delete(volumes[0]) > + > + def test_volume_vpd83(self): > + (volumes, flag_created) = self._find_or_create_volumes() > + self.assertTrue(len(volumes) > 0, "We need at least 1 volume to > test") > for v in volumes: > self.assertTrue(TestPlugin._vpd_correct(v.vpd83), > "VPD is not as expected '%s' for volume id: > '%s'" % > (v.vpd83, v.id)) > - > - self.assertTrue(len(volumes) > 0, "We need at least 1 volume to > test") > - > - if vol is not None: > - self._volume_delete(vol) > + if flag_created: > + self._volume_delete(volumes[0]) > > def test_disks_list(self): > for s in self.systems: > ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Libstoragemgmt-devel mailing list Libstoragemgmt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libstoragemgmt-devel