Skip to content

Commit b4116b5

Browse files
committed
Fix tests of "CP-51843: add unit tests for setup_cache"
Upstream patch of ae10349 is incorrect. All "@mock.patch('blktap2.VDI.PhyLink', autospec=True)" lines must be removed because PhyLink is mocked globally. Signed-off-by: Ronan Abhamon <ronan.abhamon@vates.tech>
1 parent 53c7000 commit b4116b5

1 file changed

Lines changed: 7 additions & 21 deletions

File tree

tests/test_blktap2.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,11 @@ def test_linknbd(self, nbd_link2, nbd_link):
228228
@mock.patch('blktap2.time.sleep', autospec=True)
229229
@mock.patch('blktap2.util.get_this_host', autospec=True)
230230
@mock.patch('blktap2.VDI._attach', autospec=True)
231-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
232231
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
233232
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
234233
@mock.patch('blktap2.Tapdisk')
235234
def test_activate(self, mock_tapdisk, mock_nbd_link, mock_backend,
236-
mock_phy, mock_attach,
237-
mock_this_host, mock_sleep):
235+
mock_attach, mock_this_host, mock_sleep):
238236
"""
239237
Test blktap2.VDI.activate, no cache, RW, success
240238
"""
@@ -257,14 +255,12 @@ def test_activate(self, mock_tapdisk, mock_nbd_link, mock_backend,
257255
@mock.patch('blktap2.time.sleep', autospec=True)
258256
@mock.patch('blktap2.util.get_this_host', autospec=True)
259257
@mock.patch('blktap2.VDI._attach', autospec=True)
260-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
261258
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
262259
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
263260
@mock.patch('blktap2.Tapdisk')
264261
def test_activate_relink_retry(
265262
self, mock_tapdisk, mock_nbd_link, mock_backend,
266-
mock_phy, mock_attach,
267-
mock_this_host, mock_sleep):
263+
mock_attach, mock_this_host, mock_sleep):
268264
"""
269265
Test blktap2.VDI.activate, relinking, retry 1, success
270266
"""
@@ -285,14 +281,12 @@ def test_activate_relink_retry(
285281
@mock.patch('blktap2.time.sleep', autospec=True)
286282
@mock.patch('blktap2.util.get_this_host', autospec=True)
287283
@mock.patch('blktap2.VDI._attach', autospec=True)
288-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
289284
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
290285
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
291286
@mock.patch('blktap2.Tapdisk')
292287
def test_activate_pause_retry(
293288
self, mock_tapdisk, mock_nbd_link, mock_backend,
294-
mock_phy, mock_attach,
295-
mock_this_host, mock_sleep):
289+
mock_attach, mock_this_host, mock_sleep):
296290
"""
297291
Test blktap2.VDI.activate, paused, retry 1, success
298292
"""
@@ -312,14 +306,12 @@ def test_activate_pause_retry(
312306
@mock.patch('blktap2.time.sleep', autospec=True)
313307
@mock.patch('blktap2.util.get_this_host', autospec=True)
314308
@mock.patch('blktap2.VDI._attach', autospec=True)
315-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
316309
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
317310
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
318311
@mock.patch('blktap2.Tapdisk')
319312
def test_activate_paused_while_tagging(
320313
self, mock_tapdisk, mock_nbd_link, mock_backend,
321-
mock_phy, mock_attach,
322-
mock_this_host, mock_sleep):
314+
mock_attach, mock_this_host, mock_sleep):
323315
"""
324316
Test blktap2.VDI.activate, paused, while tagging, success
325317
"""
@@ -345,14 +337,12 @@ def test_activate_paused_while_tagging(
345337
@mock.patch('blktap2.time.sleep', autospec=True)
346338
@mock.patch('blktap2.util.get_this_host', autospec=True)
347339
@mock.patch('blktap2.VDI._attach', autospec=True)
348-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
349340
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
350341
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
351342
@mock.patch('blktap2.Tapdisk')
352343
def test_activate_relink_while_tagging(
353344
self, mock_tapdisk, mock_nbd_link, mock_backend,
354-
mock_phy, mock_attach,
355-
mock_this_host, mock_sleep):
345+
mock_attach, mock_this_host, mock_sleep):
356346
"""
357347
Test blktap2.VDI.activate, relinking, while tagging, retry 1, success
358348
"""
@@ -378,14 +368,12 @@ def test_activate_relink_while_tagging(
378368
@mock.patch('blktap2.time.sleep', autospec=True)
379369
@mock.patch('blktap2.util.get_this_host', autospec=True)
380370
@mock.patch('blktap2.VDI._attach', autospec=True)
381-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
382371
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
383372
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
384373
@mock.patch('blktap2.Tapdisk')
385374
def test_activate_ro_already_activating_retry(
386375
self, mock_tapdisk, mock_nbd_link, mock_backend,
387-
mock_phy, mock_attach,
388-
mock_this_host, mock_sleep):
376+
mock_attach, mock_this_host, mock_sleep):
389377
"""
390378
If we're activating for read-only access, with someone else (let's
391379
say, another host in the pool) also being in the process of
@@ -416,14 +404,12 @@ def test_activate_ro_already_activating_retry(
416404
@mock.patch('blktap2.time.sleep', autospec=True)
417405
@mock.patch('blktap2.util.get_this_host', autospec=True)
418406
@mock.patch('blktap2.VDI._attach', autospec=True)
419-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
420407
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
421408
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
422409
@mock.patch('blktap2.Tapdisk')
423410
def test_activate_rw_already_activating_fail(
424411
self, mock_tapdisk, mock_nbd_link, mock_backend,
425-
mock_phy, mock_attach,
426-
mock_this_host, mock_sleep):
412+
mock_attach, mock_this_host, mock_sleep):
427413
"""
428414
If we're activating for read-write access, with someone else (let's
429415
say, another host in the pool) also being in the process of

0 commit comments

Comments
 (0)