Phase 3 - Cleanup tests

This commit is contained in:
Jorge Schrauwen 2018-02-17 17:16:55 +01:00
parent 01da93ec1f
commit dd29778ed5
2 changed files with 87 additions and 87 deletions

View File

@ -104,7 +104,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.create('myzpool/mydataset'), res) self.assertEqual(res, zfs.create('myzpool/mydataset'))
def test_create_success_with_create_parent(self): def test_create_success_with_create_parent(self):
''' '''
@ -118,7 +118,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.create('myzpool/mydataset/mysubdataset', create_parent=True), res) self.assertEqual(res, zfs.create('myzpool/mydataset/mysubdataset', create_parent=True))
def test_create_success_with_properties(self): def test_create_success_with_properties(self):
''' '''
@ -133,13 +133,14 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual( self.assertEqual(
res,
zfs.create( zfs.create(
'myzpool/mydataset', 'myzpool/mydataset',
properties={ properties={
'mountpoint': '/export/zfs', 'mountpoint': '/export/zfs',
'sharenfs': 'on' 'sharenfs': 'on'
} }
), res ),
) )
def test_create_error_missing_dataset(self): def test_create_error_missing_dataset(self):
@ -157,7 +158,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.create('myzpool'), res) self.assertEqual(res, zfs.create('myzpool'))
def test_create_error_trailing_slash(self): def test_create_error_trailing_slash(self):
''' '''
@ -174,7 +175,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.create('myzpool/'), res) self.assertEqual(res, zfs.create('myzpool/'))
def test_create_error_no_such_pool(self): def test_create_error_no_such_pool(self):
''' '''
@ -191,7 +192,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.create('myzpool/mydataset'), res) self.assertEqual(res, zfs.create('myzpool/mydataset'))
def test_create_error_missing_parent(self): def test_create_error_missing_parent(self):
''' '''
@ -208,7 +209,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.create('myzpool/mydataset/mysubdataset'), res) self.assertEqual(res, zfs.create('myzpool/mydataset/mysubdataset'))
def test_destroy_success(self): def test_destroy_success(self):
''' '''
@ -222,7 +223,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.destroy('myzpool/mydataset'), res) self.assertEqual(res, zfs.destroy('myzpool/mydataset'))
def test_destroy_error_not_exists(self): def test_destroy_error_not_exists(self):
''' '''
@ -239,7 +240,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.destroy('myzpool/mydataset'), res) self.assertEqual(res, zfs.destroy('myzpool/mydataset'))
def test_destroy_error_has_children(self): def test_destroy_error_has_children(self):
''' '''
@ -264,7 +265,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.destroy('myzpool/mydataset'), res) self.assertEqual(res, zfs.destroy('myzpool/mydataset'))
def test_rename_success(self): def test_rename_success(self):
''' '''
@ -278,7 +279,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.rename('myzpool/mydataset', 'myzpool/newdataset'), res) self.assertEqual(res, zfs.rename('myzpool/mydataset', 'myzpool/newdataset'))
def test_rename_error_not_exists(self): def test_rename_error_not_exists(self):
''' '''
@ -295,7 +296,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.rename('myzpool/mydataset', 'myzpool/newdataset'), res) self.assertEqual(res, zfs.rename('myzpool/mydataset', 'myzpool/newdataset'))
def test_list_success(self): def test_list_success(self):
''' '''
@ -316,7 +317,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.list_('myzpool'), res) self.assertEqual(res, zfs.list_('myzpool'))
def test_list_parsable_success(self): def test_list_parsable_success(self):
''' '''
@ -337,7 +338,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.list_('myzpool', parsable=False), res) self.assertEqual(res, zfs.list_('myzpool', parsable=False))
def test_list_custom_success(self): def test_list_custom_success(self):
''' '''
@ -358,7 +359,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.list_('myzpool', properties='canmount,used,avail,compression'), res) self.assertEqual(res, zfs.list_('myzpool', properties='canmount,used,avail,compression'))
def test_list_custom_parsable_success(self): def test_list_custom_parsable_success(self):
''' '''
@ -379,7 +380,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.list_('myzpool', properties='canmount,used,avail,compression', parsable=False), res) self.assertEqual(res, zfs.list_('myzpool', properties='canmount,used,avail,compression', parsable=False))
def test_list_error_no_dataset(self): def test_list_error_no_dataset(self):
''' '''
@ -393,7 +394,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.list_('myzpool'), res) self.assertEqual(res, zfs.list_('myzpool'))
def test_list_mount_success(self): def test_list_mount_success(self):
''' '''
@ -413,7 +414,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.list_mount(), res) self.assertEqual(res, zfs.list_mount())
def test_mount_success(self): def test_mount_success(self):
''' '''
@ -427,7 +428,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.mount('myzpool/mydataset'), res) self.assertEqual(res, zfs.mount('myzpool/mydataset'))
def test_mount_failure(self): def test_mount_failure(self):
''' '''
@ -441,7 +442,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.mount('myzpool/mydataset'), res) self.assertEqual(res, zfs.mount('myzpool/mydataset'))
def test_unmount_success(self): def test_unmount_success(self):
''' '''
@ -455,7 +456,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.unmount('myzpool/mydataset'), res) self.assertEqual(res, zfs.unmount('myzpool/mydataset'))
def test_unmount_failure(self): def test_unmount_failure(self):
''' '''
@ -472,7 +473,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.unmount('myzpool/mydataset'), res) self.assertEqual(res, zfs.unmount('myzpool/mydataset'))
def test_inherit_success(self): def test_inherit_success(self):
''' '''
@ -483,7 +484,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.inherit('compression', 'myzpool/mydataset'), res) self.assertEqual(res, zfs.inherit('compression', 'myzpool/mydataset'))
def test_inherit_failure(self): def test_inherit_failure(self):
''' '''
@ -497,7 +498,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.inherit('canmount', 'myzpool/mydataset'), res) self.assertEqual(res, zfs.inherit('canmount', 'myzpool/mydataset'))
def test_diff(self): def test_diff(self):
''' '''
@ -519,7 +520,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.diff('myzpool/mydataset@yesterday', 'myzpool/mydataset'), res) self.assertEqual(res, zfs.diff('myzpool/mydataset@yesterday', 'myzpool/mydataset'))
def test_diff_parsed_time(self): def test_diff_parsed_time(self):
''' '''
@ -543,7 +544,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.diff('myzpool/data@yesterday', 'myzpool/data', parsable=False), res) self.assertEqual(res, zfs.diff('myzpool/data@yesterday', 'myzpool/data', parsable=False))
def test_rollback_success(self): def test_rollback_success(self):
''' '''
@ -554,7 +555,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.rollback('myzpool/mydataset@yesterday'), res) self.assertEqual(res, zfs.rollback('myzpool/mydataset@yesterday'))
def test_rollback_failure(self): def test_rollback_failure(self):
''' '''
@ -580,7 +581,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.rollback('myzpool/mydataset@yesterday'), res) self.assertEqual(res, zfs.rollback('myzpool/mydataset@yesterday'))
def test_clone_success(self): def test_clone_success(self):
''' '''
@ -591,7 +592,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.clone('myzpool/mydataset@yesterday', 'myzpool/yesterday'), res) self.assertEqual(res, zfs.clone('myzpool/mydataset@yesterday', 'myzpool/yesterday'))
def test_clone_failure(self): def test_clone_failure(self):
''' '''
@ -605,7 +606,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.clone('myzpool/mydataset@yesterday', 'myzpool/archive/yesterday'), res) self.assertEqual(res, zfs.clone('myzpool/mydataset@yesterday', 'myzpool/archive/yesterday'))
def test_promote_success(self): def test_promote_success(self):
''' '''
@ -616,7 +617,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.promote('myzpool/yesterday'), res) self.assertEqual(res, zfs.promote('myzpool/yesterday'))
def test_promote_failure(self): def test_promote_failure(self):
''' '''
@ -630,7 +631,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.promote('myzpool/yesterday'), res) self.assertEqual(res, zfs.promote('myzpool/yesterday'))
def test_bookmark_success(self): def test_bookmark_success(self):
''' '''
@ -642,7 +643,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.bookmark('myzpool/mydataset@yesterday', 'myzpool/mydataset#important'), res) self.assertEqual(res, zfs.bookmark('myzpool/mydataset@yesterday', 'myzpool/mydataset#important'))
def test_holds_success(self): def test_holds_success(self):
''' '''
@ -656,7 +657,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.holds('myzpool/mydataset@baseline'), res) self.assertEqual(res, zfs.holds('myzpool/mydataset@baseline'))
def test_holds_failure(self): def test_holds_failure(self):
''' '''
@ -669,7 +670,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.holds('myzpool/mydataset@baseline'), res) self.assertEqual(res, zfs.holds('myzpool/mydataset@baseline'))
def test_hold_success(self): def test_hold_success(self):
''' '''
@ -680,7 +681,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.hold('important', 'myzpool/mydataset@baseline', 'myzpool/mydataset@release-1.0'), res) self.assertEqual(res, zfs.hold('important', 'myzpool/mydataset@baseline', 'myzpool/mydataset@release-1.0'))
def test_hold_failure(self): def test_hold_failure(self):
''' '''
@ -694,7 +695,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.hold('important', 'myzpool/mydataset@baseline'), res) self.assertEqual(res, zfs.hold('important', 'myzpool/mydataset@baseline'))
def test_release_success(self): def test_release_success(self):
''' '''
@ -705,7 +706,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.release('important', 'myzpool/mydataset@baseline', 'myzpool/mydataset@release-1.0'), res) self.assertEqual(res, zfs.release('important', 'myzpool/mydataset@baseline', 'myzpool/mydataset@release-1.0'))
def test_release_failure(self): def test_release_failure(self):
''' '''
@ -719,7 +720,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.release('important', 'myzpool/mydataset@baseline'), res) self.assertEqual(res, zfs.release('important', 'myzpool/mydataset@baseline'))
def test_snapshot_success(self): def test_snapshot_success(self):
''' '''
@ -730,7 +731,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.snapshot('myzpool/mydataset@baseline'), res) self.assertEqual(res, zfs.snapshot('myzpool/mydataset@baseline'))
def test_snapshot_failure(self): def test_snapshot_failure(self):
''' '''
@ -744,7 +745,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.snapshot('myzpool/mydataset@baseline'), res) self.assertEqual(res, zfs.snapshot('myzpool/mydataset@baseline'))
def test_snapshot_failure2(self): def test_snapshot_failure2(self):
''' '''
@ -758,7 +759,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.snapshot('myzpool/mydataset@baseline'), res) self.assertEqual(res, zfs.snapshot('myzpool/mydataset@baseline'))
def test_set_success(self): def test_set_success(self):
''' '''
@ -769,7 +770,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.set('myzpool/mydataset', compression='lz4'), res) self.assertEqual(res, zfs.set('myzpool/mydataset', compression='lz4'))
def test_set_failure(self): def test_set_failure(self):
''' '''
@ -783,7 +784,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.set('myzpool/mydataset', canmount='lz4'), res) self.assertEqual(res, zfs.set('myzpool/mydataset', canmount='lz4'))
def test_get_success(self): def test_get_success(self):
''' '''
@ -800,7 +801,7 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.get('myzpool', properties='used', fields='value'), res) self.assertEqual(res, zfs.get('myzpool', properties='used', fields='value'))
def test_get_parsable_success(self): def test_get_parsable_success(self):
''' '''
@ -817,4 +818,4 @@ class ZfsTestCase(TestCase, LoaderModuleMockMixin):
mock_cmd = MagicMock(return_value=ret) mock_cmd = MagicMock(return_value=ret)
with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zfs.__utils__, utils_patch): patch.dict(zfs.__utils__, utils_patch):
self.assertEqual(zfs.get('myzpool', properties='used', fields='value', parsable=False), res) self.assertEqual(res, zfs.get('myzpool', properties='used', fields='value', parsable=False))

View File

@ -144,7 +144,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
with patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.iostat('mypool', parsable=False) ret = zpool.iostat('mypool', parsable=False)
self.assertEqual(ret['mypool']['capacity-alloc'], '46.7G') self.assertEqual('46.7G', ret['mypool']['capacity-alloc'])
def test_iostat_parsable(self): def test_iostat_parsable(self):
''' '''
@ -172,7 +172,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
with patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}), \ with patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}), \
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.iostat('mypool', parsable=True) ret = zpool.iostat('mypool', parsable=True)
self.assertEqual(ret['mypool']['capacity-alloc'], 50143743180) self.assertEqual(50143743180, ret['mypool']['capacity-alloc'])
def test_list(self): def test_list(self):
''' '''
@ -194,7 +194,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('frag', '0%'), ('frag', '0%'),
('health', 'ONLINE'), ('health', 'ONLINE'),
]))]) ]))])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_list_parsable(self): def test_list_parsable(self):
''' '''
@ -216,7 +216,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('frag', '0%'), ('frag', '0%'),
('health', 'ONLINE'), ('health', 'ONLINE'),
]))]) ]))])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_get(self): def test_get(self):
''' '''
@ -231,7 +231,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.get('mypool', 'size', parsable=False) ret = zpool.get('mypool', 'size', parsable=False)
res = OrderedDict(OrderedDict([('size', '1.81T')])) res = OrderedDict(OrderedDict([('size', '1.81T')]))
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_get_parsable(self): def test_get_parsable(self):
''' '''
@ -246,7 +246,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.get('mypool', 'size', parsable=True) ret = zpool.get('mypool', 'size', parsable=True)
res = OrderedDict(OrderedDict([('size', 1992864825344)])) res = OrderedDict(OrderedDict([('size', 1992864825344)]))
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_get_whitespace(self): def test_get_whitespace(self):
''' '''
@ -261,7 +261,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.get('mypool', 'comment') ret = zpool.get('mypool', 'comment')
res = OrderedDict(OrderedDict([('comment', "my testing pool")])) res = OrderedDict(OrderedDict([('comment', "my testing pool")]))
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_scrub_start(self): def test_scrub_start(self):
''' '''
@ -279,7 +279,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.scrub('mypool') ret = zpool.scrub('mypool')
res = OrderedDict(OrderedDict([('scrubbing', True)])) res = OrderedDict(OrderedDict([('scrubbing', True)]))
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_scrub_pause(self): def test_scrub_pause(self):
''' '''
@ -297,7 +297,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.scrub('mypool', pause=True) ret = zpool.scrub('mypool', pause=True)
res = OrderedDict(OrderedDict([('scrubbing', False)])) res = OrderedDict(OrderedDict([('scrubbing', False)]))
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_scrub_stop(self): def test_scrub_stop(self):
''' '''
@ -315,7 +315,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.scrub('mypool', stop=True) ret = zpool.scrub('mypool', stop=True)
res = OrderedDict(OrderedDict([('scrubbing', False)])) res = OrderedDict(OrderedDict([('scrubbing', False)]))
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_split_success(self): def test_split_success(self):
''' '''
@ -331,7 +331,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.split('datapool', 'backuppool') ret = zpool.split('datapool', 'backuppool')
res = OrderedDict([('split', True)]) res = OrderedDict([('split', True)])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_split_exist_new(self): def test_split_exist_new(self):
''' '''
@ -347,7 +347,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.split('datapool', 'backuppool') ret = zpool.split('datapool', 'backuppool')
res = OrderedDict([('split', False), ('error', 'Unable to split datapool: pool already exists')]) res = OrderedDict([('split', False), ('error', 'Unable to split datapool: pool already exists')])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_split_missing_pool(self): def test_split_missing_pool(self):
''' '''
@ -363,7 +363,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.split('datapool', 'backuppool') ret = zpool.split('datapool', 'backuppool')
res = OrderedDict([('split', False), ('error', "cannot open 'datapool': no such pool")]) res = OrderedDict([('split', False), ('error', "cannot open 'datapool': no such pool")])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_split_not_mirror(self): def test_split_not_mirror(self):
''' '''
@ -379,7 +379,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.split('datapool', 'backuppool') ret = zpool.split('datapool', 'backuppool')
res = OrderedDict([('split', False), ('error', 'Unable to split datapool: Source pool must be composed only of mirrors')]) res = OrderedDict([('split', False), ('error', 'Unable to split datapool: Source pool must be composed only of mirrors')])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_labelclear_success(self): def test_labelclear_success(self):
''' '''
@ -395,7 +395,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.labelclear('/dev/rdsk/c0t0d0', force=False) ret = zpool.labelclear('/dev/rdsk/c0t0d0', force=False)
res = OrderedDict([('labelcleared', True)]) res = OrderedDict([('labelcleared', True)])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_labelclear_nodevice(self): def test_labelclear_nodevice(self):
''' '''
@ -414,7 +414,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('labelcleared', False), ('labelcleared', False),
('error', 'failed to open /dev/rdsk/c0t0d0: No such file or directory'), ('error', 'failed to open /dev/rdsk/c0t0d0: No such file or directory'),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_labelclear_cleared(self): def test_labelclear_cleared(self):
''' '''
@ -433,7 +433,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('labelcleared', False), ('labelcleared', False),
('error', 'failed to read label from /dev/rdsk/c0t0d0'), ('error', 'failed to read label from /dev/rdsk/c0t0d0'),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_labelclear_exported(self): def test_labelclear_exported(self):
''' '''
@ -454,7 +454,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('labelcleared', False), ('labelcleared', False),
('error', 'use \'force=True\' to override the following error:\n/dev/rdsk/c0t0d0 is a member of exported pool "mypool"'), ('error', 'use \'force=True\' to override the following error:\n/dev/rdsk/c0t0d0 is a member of exported pool "mypool"'),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
@skipIf(not salt.utils.path.which('mkfile'), 'Cannot find mkfile executable') @skipIf(not salt.utils.path.which('mkfile'), 'Cannot find mkfile executable')
def test_create_file_vdev_success(self): def test_create_file_vdev_success(self):
@ -473,7 +473,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
res = OrderedDict([ res = OrderedDict([
('/vdisks/disk0', 'created'), ('/vdisks/disk0', 'created'),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
@skipIf(not salt.utils.path.which('mkfile'), 'Cannot find mkfile executable') @skipIf(not salt.utils.path.which('mkfile'), 'Cannot find mkfile executable')
def test_create_file_vdev_nospace(self): def test_create_file_vdev_nospace(self):
@ -495,7 +495,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('/vdisks/disk0', ' initialized 10424320 of 67108864 bytes: No space left on device'), ('/vdisks/disk0', ' initialized 10424320 of 67108864 bytes: No space left on device'),
])), ])),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_export_success(self): def test_export_success(self):
''' '''
@ -511,7 +511,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.export('mypool') ret = zpool.export('mypool')
res = OrderedDict([('exported', True)]) res = OrderedDict([('exported', True)])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_export_nopool(self): def test_export_nopool(self):
''' '''
@ -527,7 +527,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.export('mypool') ret = zpool.export('mypool')
res = OrderedDict([('exported', False), ('error', "cannot open 'mypool': no such pool")]) res = OrderedDict([('exported', False), ('error', "cannot open 'mypool': no such pool")])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_import_success(self): def test_import_success(self):
''' '''
@ -543,7 +543,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.import_('mypool') ret = zpool.import_('mypool')
res = OrderedDict([('imported', True)]) res = OrderedDict([('imported', True)])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_import_duplicate(self): def test_import_duplicate(self):
''' '''
@ -565,7 +565,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('imported', False), ('imported', False),
('error', "cannot import 'mypool': a pool with that name already exists\nuse the form 'zpool import <pool | id> <newpool>' to give it a new name"), ('error', "cannot import 'mypool': a pool with that name already exists\nuse the form 'zpool import <pool | id> <newpool>' to give it a new name"),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_import_nopool(self): def test_import_nopool(self):
''' '''
@ -584,7 +584,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('imported', False), ('imported', False),
('error', "cannot import 'mypool': no such pool available"), ('error', "cannot import 'mypool': no such pool available"),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_online_success(self): def test_online_success(self):
''' '''
@ -600,7 +600,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.online('mypool', '/dev/rdsk/c0t0d0') ret = zpool.online('mypool', '/dev/rdsk/c0t0d0')
res = OrderedDict([('onlined', True)]) res = OrderedDict([('onlined', True)])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_online_nodevice(self): def test_online_nodevice(self):
''' '''
@ -619,7 +619,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('onlined', False), ('onlined', False),
('error', 'cannot online /dev/rdsk/c0t0d1: no such device in pool'), ('error', 'cannot online /dev/rdsk/c0t0d1: no such device in pool'),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_offline_success(self): def test_offline_success(self):
''' '''
@ -635,7 +635,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.offline('mypool', '/dev/rdsk/c0t0d0') ret = zpool.offline('mypool', '/dev/rdsk/c0t0d0')
res = OrderedDict([('offlined', True)]) res = OrderedDict([('offlined', True)])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_offline_nodevice(self): def test_offline_nodevice(self):
''' '''
@ -654,7 +654,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('offlined', False), ('offlined', False),
('error', 'cannot offline /dev/rdsk/c0t0d1: no such device in pool'), ('error', 'cannot offline /dev/rdsk/c0t0d1: no such device in pool'),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_offline_noreplica(self): def test_offline_noreplica(self):
''' '''
@ -673,7 +673,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('offlined', False), ('offlined', False),
('error', 'cannot offline /dev/rdsk/c0t0d1: no valid replicas'), ('error', 'cannot offline /dev/rdsk/c0t0d1: no valid replicas'),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_reguid_success(self): def test_reguid_success(self):
''' '''
@ -689,7 +689,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.reguid('mypool') ret = zpool.reguid('mypool')
res = OrderedDict([('reguided', True)]) res = OrderedDict([('reguided', True)])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_reguid_nopool(self): def test_reguid_nopool(self):
''' '''
@ -708,7 +708,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('reguided', False), ('reguided', False),
('error', "cannot open 'mypool': no such pool"), ('error', "cannot open 'mypool': no such pool"),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_reopen_success(self): def test_reopen_success(self):
''' '''
@ -724,7 +724,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.reopen('mypool') ret = zpool.reopen('mypool')
res = OrderedDict([('reopened', True)]) res = OrderedDict([('reopened', True)])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_reopen_nopool(self): def test_reopen_nopool(self):
''' '''
@ -743,7 +743,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('reopened', False), ('reopened', False),
('error', "cannot open 'mypool': no such pool"), ('error', "cannot open 'mypool': no such pool"),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_upgrade_success(self): def test_upgrade_success(self):
''' '''
@ -759,7 +759,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.upgrade('mypool') ret = zpool.upgrade('mypool')
res = OrderedDict([('upgraded', True)]) res = OrderedDict([('upgraded', True)])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_upgrade_nopool(self): def test_upgrade_nopool(self):
''' '''
@ -778,7 +778,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('upgraded', False), ('upgraded', False),
('error', "cannot open 'mypool': no such pool"), ('error', "cannot open 'mypool': no such pool"),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_history_success(self): def test_history_success(self):
''' '''
@ -803,7 +803,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('2018-01-19.16:01:55', 'zpool attach -f mypool /dev/rdsk/c0t0d0 /dev/rdsk/c0t0d1'), ('2018-01-19.16:01:55', 'zpool attach -f mypool /dev/rdsk/c0t0d0 /dev/rdsk/c0t0d1'),
])), ])),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_history_nopool(self): def test_history_nopool(self):
''' '''
@ -821,7 +821,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
res = OrderedDict([ res = OrderedDict([
('error', "cannot open 'mypool': no such pool"), ('error', "cannot open 'mypool': no such pool"),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_clear_success(self): def test_clear_success(self):
''' '''
@ -837,7 +837,7 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
patch.dict(zpool.__utils__, utils_patch): patch.dict(zpool.__utils__, utils_patch):
ret = zpool.clear('mypool') ret = zpool.clear('mypool')
res = OrderedDict([('cleared', True)]) res = OrderedDict([('cleared', True)])
self.assertEqual(res, ret) self.assertEqual(ret, res)
def test_clear_nopool(self): def test_clear_nopool(self):
''' '''
@ -874,5 +874,4 @@ class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
('cleared', False), ('cleared', False),
('error', "cannot clear errors for /dev/rdsk/c0t0d0: no such device in pool"), ('error', "cannot clear errors for /dev/rdsk/c0t0d0: no such device in pool"),
]) ])
self.assertEqual(res, ret) self.assertEqual(ret, res)
self.assertEqual(res, ret)