Skip to content

Commit 921f385

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 ca5b52d commit 921f385

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
@@ -227,13 +227,11 @@ def test_linknbd(self, nbd_link2, nbd_link):
227227
@mock.patch('blktap2.time.sleep', autospec=True)
228228
@mock.patch('blktap2.util.get_this_host', autospec=True)
229229
@mock.patch('blktap2.VDI._attach', autospec=True)
230-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
231230
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
232231
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
233232
@mock.patch('blktap2.Tapdisk')
234233
def test_activate(self, mock_tapdisk, mock_nbd_link, mock_backend,
235-
mock_phy, mock_attach,
236-
mock_this_host, mock_sleep):
234+
mock_attach, mock_this_host, mock_sleep):
237235
"""
238236
Test blktap2.VDI.activate, no cache, RW, success
239237
"""
@@ -256,14 +254,12 @@ def test_activate(self, mock_tapdisk, mock_nbd_link, mock_backend,
256254
@mock.patch('blktap2.time.sleep', autospec=True)
257255
@mock.patch('blktap2.util.get_this_host', autospec=True)
258256
@mock.patch('blktap2.VDI._attach', autospec=True)
259-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
260257
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
261258
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
262259
@mock.patch('blktap2.Tapdisk')
263260
def test_activate_relink_retry(
264261
self, mock_tapdisk, mock_nbd_link, mock_backend,
265-
mock_phy, mock_attach,
266-
mock_this_host, mock_sleep):
262+
mock_attach, mock_this_host, mock_sleep):
267263
"""
268264
Test blktap2.VDI.activate, relinking, retry 1, success
269265
"""
@@ -284,14 +280,12 @@ def test_activate_relink_retry(
284280
@mock.patch('blktap2.time.sleep', autospec=True)
285281
@mock.patch('blktap2.util.get_this_host', autospec=True)
286282
@mock.patch('blktap2.VDI._attach', autospec=True)
287-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
288283
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
289284
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
290285
@mock.patch('blktap2.Tapdisk')
291286
def test_activate_pause_retry(
292287
self, mock_tapdisk, mock_nbd_link, mock_backend,
293-
mock_phy, mock_attach,
294-
mock_this_host, mock_sleep):
288+
mock_attach, mock_this_host, mock_sleep):
295289
"""
296290
Test blktap2.VDI.activate, paused, retry 1, success
297291
"""
@@ -311,14 +305,12 @@ def test_activate_pause_retry(
311305
@mock.patch('blktap2.time.sleep', autospec=True)
312306
@mock.patch('blktap2.util.get_this_host', autospec=True)
313307
@mock.patch('blktap2.VDI._attach', autospec=True)
314-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
315308
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
316309
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
317310
@mock.patch('blktap2.Tapdisk')
318311
def test_activate_paused_while_tagging(
319312
self, mock_tapdisk, mock_nbd_link, mock_backend,
320-
mock_phy, mock_attach,
321-
mock_this_host, mock_sleep):
313+
mock_attach, mock_this_host, mock_sleep):
322314
"""
323315
Test blktap2.VDI.activate, paused, while tagging, success
324316
"""
@@ -344,14 +336,12 @@ def test_activate_paused_while_tagging(
344336
@mock.patch('blktap2.time.sleep', autospec=True)
345337
@mock.patch('blktap2.util.get_this_host', autospec=True)
346338
@mock.patch('blktap2.VDI._attach', autospec=True)
347-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
348339
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
349340
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
350341
@mock.patch('blktap2.Tapdisk')
351342
def test_activate_relink_while_tagging(
352343
self, mock_tapdisk, mock_nbd_link, mock_backend,
353-
mock_phy, mock_attach,
354-
mock_this_host, mock_sleep):
344+
mock_attach, mock_this_host, mock_sleep):
355345
"""
356346
Test blktap2.VDI.activate, relinking, while tagging, retry 1, success
357347
"""
@@ -377,14 +367,12 @@ def test_activate_relink_while_tagging(
377367
@mock.patch('blktap2.time.sleep', autospec=True)
378368
@mock.patch('blktap2.util.get_this_host', autospec=True)
379369
@mock.patch('blktap2.VDI._attach', autospec=True)
380-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
381370
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
382371
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
383372
@mock.patch('blktap2.Tapdisk')
384373
def test_activate_ro_already_activating_retry(
385374
self, mock_tapdisk, mock_nbd_link, mock_backend,
386-
mock_phy, mock_attach,
387-
mock_this_host, mock_sleep):
375+
mock_attach, mock_this_host, mock_sleep):
388376
"""
389377
If we're activating for read-only access, with someone else (let's
390378
say, another host in the pool) also being in the process of
@@ -415,14 +403,12 @@ def test_activate_ro_already_activating_retry(
415403
@mock.patch('blktap2.time.sleep', autospec=True)
416404
@mock.patch('blktap2.util.get_this_host', autospec=True)
417405
@mock.patch('blktap2.VDI._attach', autospec=True)
418-
@mock.patch('blktap2.VDI.PhyLink', autospec=True)
419406
@mock.patch('blktap2.VDI.BackendLink', autospec=True)
420407
@mock.patch('blktap2.VDI.NBDLink', autospec=True)
421408
@mock.patch('blktap2.Tapdisk')
422409
def test_activate_rw_already_activating_fail(
423410
self, mock_tapdisk, mock_nbd_link, mock_backend,
424-
mock_phy, mock_attach,
425-
mock_this_host, mock_sleep):
411+
mock_attach, mock_this_host, mock_sleep):
426412
"""
427413
If we're activating for read-write access, with someone else (let's
428414
say, another host in the pool) also being in the process of

0 commit comments

Comments
 (0)