From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoFUz-0007R2-IL for qemu-devel@nongnu.org; Mon, 19 Oct 2015 14:49:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoFUv-0007IC-IY for qemu-devel@nongnu.org; Mon, 19 Oct 2015 14:49:33 -0400 From: Max Reitz Date: Mon, 19 Oct 2015 20:49:06 +0200 Message-Id: <1445280546-26226-7-git-send-email-mreitz@redhat.com> In-Reply-To: <1445280546-26226-1-git-send-email-mreitz@redhat.com> References: <1445280546-26226-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v5 6/6] iotests: Test changed Quorum filename List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz After drive-mirror replacing a Quorum child, the filename of the Quorum BDS should reflect the change. This patch replaces the existing test for whether the operation did actually exchange the BDS (which simply tested whether the new BDS existed) by a test which examines the children list contained in the Quorum BDS's filename as returned by query-block. As a nice side effect of confirming that the new BDS actually belongs to the Quorum BDS, this checks whether the filename was properly updated. Signed-off-by: Max Reitz --- tests/qemu-iotests/041 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 05b5962..6703882 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -18,6 +18,7 @@ # along with this program. If not, see . # +import json import time import os import iotests @@ -920,10 +921,18 @@ class TestRepairQuorum(iotests.QMPTestCase): self.assert_qmp(result, 'return', {}) self.complete_and_wait(drive="quorum0") - result = self.vm.qmp('query-named-block-nodes') - self.assert_qmp(result, 'return[0]/file', quorum_repair_img) - # TODO: a better test requiring some QEMU infrastructure will be added - # to check that this file is really driven by quorum + + result = self.vm.qmp('query-block') + for blockdev in result['return']: + if blockdev['device'] == 'quorum0': + filename = blockdev['inserted']['image']['filename'] + self.assertEquals(filename[:5], 'json:') + children = json.loads(filename[5:])['children'] + self.assertEquals(children[0]['file']['filename'], quorum_img1) + self.assertEquals(children[1]['file']['filename'], + quorum_repair_img) + self.assertEquals(children[2]['file']['filename'], quorum_img3) + self.vm.shutdown() if __name__ == '__main__': -- 2.6.1