Merge ~raharper/curtin:fix-missing-zfs-supported-mock into curtin:master

Proposed by Ryan Harper
Status: Merged
Approved by: Scott Moser
Approved revision: df25e6b718ee803b3fbe496d133a4a35198a7b6e
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~raharper/curtin:fix-missing-zfs-supported-mock
Merge into: curtin:master
Diff against target: 19 lines (+6/-1)
1 file modified
tests/unittests/test_block_zfs.py (+6/-1)
Reviewer Review Type Date Requested Status
Scott Moser (community) Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+353364@code.launchpad.net

Commit message

Don't allow reads of /proc and modprobe zfs through

New zfs_supported check reads /proc/filesystems to see if
zfs is already available and attempts to modprobe. These things
fail under launchpad sbuilds. Make sure to mock out the calls to
these functions and provide positive values for the failing unittest.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tests/unittests/test_block_zfs.py b/tests/unittests/test_block_zfs.py
2index ca8f118..c18f6a3 100644
3--- a/tests/unittests/test_block_zfs.py
4+++ b/tests/unittests/test_block_zfs.py
5@@ -385,8 +385,13 @@ class TestBlockZfsAssertZfsSupported(CiTestCase):
6 self.add_patch('curtin.block.zfs.util.subp', 'mock_subp')
7 self.add_patch('curtin.block.zfs.util.get_platform_arch', 'mock_arch')
8 self.add_patch('curtin.block.zfs.util.lsb_release', 'mock_release')
9- self.mock_release.return_value = {'codename': 'xenial'}
10+ self.add_patch('curtin.block.zfs.util.which', 'mock_which')
11+ self.add_patch('curtin.block.zfs.get_supported_filesystems',
12+ 'mock_supfs')
13 self.mock_arch.return_value = 'x86_64'
14+ self.mock_release.return_value = {'codename': 'xenial'}
15+ self.mock_supfs.return_value = ['zfs']
16+ self.mock_which.return_value = True
17
18 def test_supported_arch(self):
19 self.assertTrue(zfs.zfs_supported())

Subscribers

People subscribed via source and target branches