Merge ~mwhudson/curtin:too-much-mocking into curtin:master

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: fdad2d2743c20223d0c5d6b8d2c6d698945a0804
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~mwhudson/curtin:too-much-mocking
Merge into: curtin:master
Diff against target: 45 lines (+7/-6)
1 file modified
tests/unittests/test_commands_block_meta.py (+7/-6)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Dan Bungert Approve
Review via email: mp+448102@code.launchpad.net

Commit message

test_commands_block_meta: do not assert test creates 0 sized partition

TestMultipathPartitionHandler.setUp() mocks out the entire util module,
which had some unintended consequences that were baked into the test
expectations. Scope the mocking better and fix the test's expectations.

To post a comment you must log in.
Revision history for this message
Dan Bungert (dbungert) wrote :

One suggested tweak

review: Approve
~mwhudson/curtin:too-much-mocking updated
fdad2d2... by Michael Hudson-Doyle

remove leftover debugging

Revision history for this message
Michael Hudson-Doyle (mwhudson) :
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tests/unittests/test_commands_block_meta.py b/tests/unittests/test_commands_block_meta.py
2index f1bc18c..028d04e 100644
3--- a/tests/unittests/test_commands_block_meta.py
4+++ b/tests/unittests/test_commands_block_meta.py
5@@ -2759,7 +2759,8 @@ class TestMultipathPartitionHandler(CiTestCase):
6
7 basepath = 'curtin.commands.block_meta.'
8 self.add_patch(basepath + 'get_path_to_storage_volume', 'm_getpath')
9- self.add_patch(basepath + 'util', 'm_util')
10+ self.add_patch(basepath + 'util.subp', 'm_subp')
11+ self.add_patch(basepath + 'util.del_file', 'm_del_file')
12 self.add_patch(basepath + 'make_dname', 'm_dname')
13 self.add_patch(basepath + 'block', 'm_block')
14 self.add_patch(basepath + 'multipath', 'm_mp')
15@@ -2813,11 +2814,11 @@ class TestMultipathPartitionHandler(CiTestCase):
16 block_meta.partition_handler(part2, self.storage_config, empty_context)
17
18 expected_calls = [
19- call(['sgdisk', '--new', '2:4096:4096', '--typecode=2:8300',
20+ call(['sgdisk', '--new', '2:4096:10489855', '--typecode=2:8300',
21 disk_path], capture=True),
22 call(['kpartx', '-v', '-a', '-s', '-p', '-part', disk_path]),
23 ]
24- self.assertEqual(expected_calls, self.m_util.subp.call_args_list)
25+ self.assertEqual(expected_calls, self.m_subp.call_args_list)
26
27 @patch('curtin.commands.block_meta.os.path')
28 @patch('curtin.commands.block_meta.calc_partition_info')
29@@ -2842,13 +2843,13 @@ class TestMultipathPartitionHandler(CiTestCase):
30 block_meta.partition_handler(part2, self.storage_config, empty_context)
31
32 expected_calls = [
33- call(['sgdisk', '--new', '2:4096:4096', '--typecode=2:8300',
34+ call(['sgdisk', '--new', '2:4096:10489855', '--typecode=2:8300',
35 disk_path], capture=True),
36 call(['kpartx', '-v', '-a', '-s', '-p', '-part', disk_path]),
37 ]
38- self.assertEqual(expected_calls, self.m_util.subp.call_args_list)
39+ self.assertEqual(expected_calls, self.m_subp.call_args_list)
40 self.assertEqual([call(disk_path + '-part2')],
41- self.m_util.del_file.call_args_list)
42+ self.m_del_file.call_args_list)
43
44
45 class TestCalcPartitionInfo(CiTestCase):

Subscribers

People subscribed via source and target branches