iotests/118: Test inserting a read-only medium

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
Kevin Wolf 2019-07-30 16:50:52 +02:00
parent 0b9e918f03
commit 6817416014
2 changed files with 7 additions and 3 deletions

View File

@ -207,10 +207,11 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
def test_cycle(self):
def test_cycle(self, read_only_node=False):
result = self.vm.qmp('blockdev-add',
node_name='new',
driver=iotests.imgfmt,
read_only=read_only_node,
file={'filename': new_img,
'driver': 'file'})
self.assert_qmp(result, 'return', {})
@ -257,6 +258,9 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.assert_qmp(result, 'return[0]/tray_open', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
def test_cycle_read_only_media(self):
self.test_cycle(True)
def test_close_on_closed(self):
result = self.vm.qmp('blockdev-close-tray', id=self.device_name)
# Should be a no-op

View File

@ -1,5 +1,5 @@
...........................................................
...............................................................
----------------------------------------------------------------------
Ran 59 tests
Ran 63 tests
OK