Skip to content

Commit 6afc9fa

Browse files
committed
Fix tests after merge conflicts
The commits 2ac4e67 & baa7044 whilst independently passing the unit tests fail when combined as baa7044 introduced a call `vhdutil.getBlockSize` in the snapshot path which was not mocked by the tests added in 2ac4e67. Add this mocking to fix the test. Signed-off-by: Mark Syms <[email protected]>
1 parent baa7044 commit 6afc9fa

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/test_LVHDSR.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,51 @@
1515

1616
PV_FOR_VG_DATA = "/dev/mapper/3600a098038314650465d523777417142"
1717

18+
VHD_UTIL = '/usr/bin/vhd-util'
19+
20+
TEST_VHD_HEADER = """
21+
VHD Footer Summary:
22+
-------------------
23+
Cookie : conectix
24+
Features : (0x00000002) <RESV>
25+
File format version : Major: 1, Minor: 0
26+
Data offset : 512
27+
Timestamp : Mon Apr 14 09:32:51 2025
28+
Creator Application : 'tap'
29+
Creator version : Major: 1, Minor: 3
30+
Creator OS : Unknown!
31+
Original disk size : 49096 MB (51480887296 Bytes)
32+
Current disk size : 49096 MB (51480887296 Bytes)
33+
Geometry : Cyl: 24644, Hds: 16, Sctrs: 255
34+
: = 49095 MB (51480330240 Bytes)
35+
Disk type : Dynamic hard disk
36+
Checksum : 0xffffed34|0xffffed34 (Good!)
37+
UUID : e21541f1-0daf-4394-9d80-3c0bfe957b1b
38+
Saved state : No
39+
Hidden : 0
40+
41+
VHD Header Summary:
42+
-------------------
43+
Cookie : cxsparse
44+
Data offset (unusd) : 18446744073709551615
45+
Table offset : 1536
46+
Header version : 0x00010000
47+
Max BAT size : 24548
48+
Block size : 2097152 (2 MB)
49+
Parent name :
50+
Parent UUID : 00000000-0000-0000-0000-000000000000
51+
Parent timestamp : Sat Jan 1 00:00:00 2000
52+
Checksum : 0xfffff334|0xfffff334 (Good!)
53+
54+
VHD Batmap Summary:
55+
-------------------
56+
Batmap offset : 100352
57+
Batmap size (secs) : 6
58+
Batmap version : 0x00010002
59+
Checksum : 0xfffeb525|0xfffeb525 (Good!)
60+
"""
61+
62+
1863

1964
class SMLog(object):
2065
def __call__(self, *args):
@@ -318,6 +363,12 @@ def test_snapshotof_success(self,
318363
mock_lock,
319364
mock_ipc,
320365
mock_cleanup):
366+
367+
def test_function(args, inp):
368+
assert args[1] == "read"
369+
return 0, TEST_VHD_HEADER, ""
370+
371+
context.add_executable(VHD_UTIL, test_function)
321372
sr_uuid = str(uuid.uuid4())
322373
self.stubout('sm.drivers.LVHDSR.lvutil._checkVG', autospec=True)
323374
mock_lvm_cache = self.stubout('sm.drivers.LVHDSR.lvmcache.LVMCache')

0 commit comments

Comments
 (0)