Skip to content

Commit

Permalink
reflect upstream changes in our tests
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Reis <[email protected]>
  • Loading branch information
benjamreis committed Aug 13, 2024
1 parent d2d42c1 commit ef7a02d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 2 additions & 5 deletions tests/test_ISOSR.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,14 @@ def test_attach_and_detach_local_with_mounted_path(
isosr.detach(None)
self.assertFalse(pread.called)

@testlib.with_context
@mock.patch('os.path.exists')
@mock.patch('util.pread')
def test_attach_local_with_bad_path(self, context, pread, exists):
context.setup_error_codes()

def test_attach_local_with_bad_path(self, pread, exists):
# Local path doesn't exist, but error list yes.
exists.side_effect = [False, True]

isosr = self.create_isosr()
with self.assertRaises(SR.SROSError) as ose:
with self.assertRaises(xs_errors.SROSError) as ose:
isosr.attach(None)
self.assertEqual(ose.exception.errno, 226)
self.assertFalse(pread.called)
Expand Down
7 changes: 4 additions & 3 deletions tests/test_ZFSSR.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import SR
import ZFSSR
import xs_errors


XML_DEFS = os.path.dirname(os.path.abspath(__file__)) + \
Expand Down Expand Up @@ -51,7 +52,7 @@ def test_load_with_zfs_unavailable(self):
failed = False
try:
self.create_zfs_sr()
except SR.SROSError as e:
except xs_errors.SROSError as e:
# Check SRUnavailable error.
failed = e.errno == 47
self.assertTrue(failed)
Expand All @@ -76,7 +77,7 @@ def test_create_with_invalid_zfs_path(
sr = self.create_zfs_sr()
try:
sr.create(sr.uuid, 42)
except SR.SROSError as e:
except xs_errors.SROSError as e:
# Check ZFSSRCreate error.
failed = e.errno == 5000
self.assertTrue(failed)
Expand Down Expand Up @@ -109,7 +110,7 @@ def test_scan_with_invalid_zfs_path(
sr = self.create_zfs_sr()
try:
sr.scan(sr.uuid)
except SR.SROSError as e:
except xs_errors.SROSError as e:
# Check SRUnavailable error.
failed = e.errno == 47
self.assertTrue(failed)

0 comments on commit ef7a02d

Please sign in to comment.