The test was using 'human-monitor-command' (which requires HMP) to
verify that an integer 'id' is echoed back on failure. Replace with
'query-name' for the success case and 'block_resize' (missing
required args) for the failure case, so the test works regardless of
HMP availability.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/qtest/qmp-test.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c
index edf08867874..03637b9e2d2 100644
--- a/tests/qtest/qmp-test.c
+++ b/tests/qtest/qmp-test.c
@@ -151,9 +151,14 @@ static void test_qmp_protocol(void)
g_assert_cmpstr(qdict_get_try_str(resp, "id"), ==, "cookie#1");
qobject_unref(resp);
- /* Test command failure with 'id' */
- resp = qtest_qmp(qts, "{ 'execute': 'human-monitor-command', 'id': 2 }");
+ /* Test integer 'id' is echoed back on success */
+ resp = qtest_qmp(qts, "{ 'execute': 'query-name', 'id': 2 }");
g_assert_cmpint(qdict_get_int(resp, "id"), ==, 2);
+ qobject_unref(resp);
+
+ /* Test integer 'id' is echoed back on failure */
+ resp = qtest_qmp(qts, "{ 'execute': 'block_resize', 'id': 3 }");
+ g_assert_cmpint(qdict_get_int(resp, "id"), ==, 3);
qmp_expect_error_and_unref(resp, "GenericError");
qtest_quit(qts);
--
2.54.0