diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> | 2023-10-06 18:41:25 +0300 |
---|---|---|
committer | John Snow <jsnow@redhat.com> | 2023-10-12 14:21:44 -0400 |
commit | b6aed193e5ecca32bb07e062f58f0daca06e7009 (patch) | |
tree | 869a1bf90b35f8bff095472c3c9f9ccd5631fe26 /tests/qemu-iotests/296 | |
parent | 25ad2cf6500db3b7f2d88de448791183d7614097 (diff) |
python: use vm.cmd() instead of vm.qmp() where appropriate
In many cases we just want an effect of qmp command and want to raise
on failure. Use vm.cmd() method which does exactly this.
The commit is generated by command
git grep -l '\.qmp(' | xargs ./scripts/python_qmp_updater.py
And then, fix self.assertRaises to expect ExecuteError exception in
tests/qemu-iotests/124
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20231006154125.1068348-16-vsementsov@yandex-team.ru
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/296')
-rwxr-xr-x | tests/qemu-iotests/296 | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/qemu-iotests/296 b/tests/qemu-iotests/296 index 47d2526b72..2b63cefff0 100755 --- a/tests/qemu-iotests/296 +++ b/tests/qemu-iotests/296 @@ -61,10 +61,8 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): # create the secrets and load 'em into the VMs self.secrets = [ Secret(i) for i in range(0, 4) ] for secret in self.secrets: - result = self.vm1.qmp("object-add", secret.to_qmp_object()) - self.assert_qmp(result, 'return', {}) - result = self.vm2.qmp("object-add", secret.to_qmp_object()) - self.assert_qmp(result, 'return', {}) + self.vm1.cmd("object-add", secret.to_qmp_object()) + self.vm2.cmd("object-add", secret.to_qmp_object()) # test case shutdown def tearDown(self): @@ -132,11 +130,9 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): } if reOpen: - result = vm.qmp(command, options=[opts]) - self.assert_qmp(result, 'return', {}) + vm.cmd(command, options=[opts]) else: - result = vm.qmp(command, opts) - self.assert_qmp(result, 'return', {}) + vm.cmd(command, opts) ########################################################################### @@ -154,8 +150,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase): # close the encrypted block device def closeImageQmp(self, vm, id): - result = vm.qmp('blockdev-del', {'node-name': id}) - self.assert_qmp(result, 'return', {}) + vm.cmd('blockdev-del', {'node-name': id}) ########################################################################### |