[prev in list] [next in list] [prev in thread] [next in thread]
List: lvm2-commits
Subject: =?utf-8?q?=5Blvm2-commits=5D?= master - lvmdbustest.py: Create common func. _create_cache_lv
From: Tony Asleson <tasleson () sourceware ! org>
Date: 2019-10-30 15:47:17
Message-ID: 20191030154717.EFAFC5A7D3E7B () mailman01 ! phx2 ! fedoraproject ! org
[Download RAW message or body]
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=455498f206e60c513ce36083d1f336aad11e33f8
Commit: 455498f206e60c513ce36083d1f336aad11e33f8
Parent: c786636afba068fc0f560b6dd1dd9dd532c35135
Author: Tony Asleson <tasleson@redhat.com>
AuthorDate: Wed Oct 9 12:29:52 2019 -0500
Committer: Tony Asleson <tasleson@redhat.com>
CommitterDate: Wed Oct 30 10:38:40 2019 -0500
lvmdbustest.py: Create common func. _create_cache_lv
---
test/dbus/lvmdbustest.py | 52 ++++++++++++++++++---------------------------
1 files changed, 21 insertions(+), 31 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 0b7140a..aed5511 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1424,22 +1424,25 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(
'/com/redhat/lvmdbus1/CachePool' in cache_pool.object_path)
- def test_cache_lv_create(self):
+ def _create_cache_lv(self):
+ vg, cache_pool = self._create_cache_pool()
- for destroy_cache in [True, False]:
- vg, cache_pool = self._create_cache_pool()
+ lv_to_cache = self._create_lv(size=mib(8), vg=vg)
- lv_to_cache = self._create_lv(size=mib(8), vg=vg)
+ c_lv_path = self.handle_return(
+ cache_pool.CachePool.CacheLv(
+ dbus.ObjectPath(lv_to_cache.object_path),
+ dbus.Int32(g_tmo),
+ EOD))
- c_lv_path = self.handle_return(
- cache_pool.CachePool.CacheLv(
- dbus.ObjectPath(lv_to_cache.object_path),
- dbus.Int32(g_tmo),
- EOD))
+ intf = (LV_COMMON_INT, LV_INT, CACHE_LV_INT)
+ cached_lv = ClientProxy(self.bus, c_lv_path, interfaces=intf)
+ return vg, cache_pool, cached_lv
- intf = (LV_COMMON_INT, LV_INT, CACHE_LV_INT)
- cached_lv = ClientProxy(self.bus, c_lv_path, interfaces=intf)
+ def test_cache_lv_create(self):
+ for destroy_cache in [True, False]:
+ vg, _, cached_lv = self._create_cache_lv()
uncached_lv_path = self.handle_return(
cached_lv.CachedLv.DetachCachePool(
dbus.Boolean(destroy_cache),
@@ -1459,31 +1462,18 @@ class TestDbusService(unittest.TestCase):
internal state update.
:return:
"""
- vg, cache_pool = self._create_cache_pool()
-
- lv_to_cache = self._create_lv(size=mib(8), vg=vg)
-
- c_lv_path = self.handle_return(
- cache_pool.CachePool.CacheLv(
- dbus.ObjectPath(lv_to_cache.object_path),
- dbus.Int32(g_tmo),
- EOD))
+ def verify_cache_lv_count():
+ cur_objs, _ = get_objects()
+ self.assertEqual(len(cur_objs[CACHE_LV_INT]), 2)
+ self._check_consistency()
- # Make sure we only have expected # of cached LV
- cur_objs, _ = get_objects()
- self.assertEqual(len(cur_objs[CACHE_LV_INT]), 2)
+ _, _, cached_lv = self._create_cache_lv()
- intf = (LV_COMMON_INT, LV_INT, CACHE_LV_INT)
- cached_lv = ClientProxy(self.bus, c_lv_path, interfaces=intf)
+ verify_cache_lv_count()
new_name = 'renamed_' + cached_lv.LvCommon.Name
-
self.handle_return(
cached_lv.Lv.Rename(dbus.String(new_name), dbus.Int32(g_tmo), EOD))
-
- # Make sure we only have expected # of cached LV
- cur_objs, _ = get_objects()
- self.assertEqual(len(cur_objs[CACHE_LV_INT]), 2)
- self._check_consistency()
+ verify_cache_lv_count()
def test_vg_change(self):
vg_proxy = self._vg_create()
_______________________________________________
lvm2-commits mailing list -- lvm2-commits@lists.fedorahosted.org
To unsubscribe send an email to lvm2-commits-leave@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/lvm2-commits@lists.fedorahosted.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic