From b1c8bbb93cd5446a97d357a4d65c2da9544cdb43 Mon Sep 17 00:00:00 2001 From: Lily Zhu Date: Sun, 11 Dec 2016 03:55:53 +0800 Subject: [PATCH] Add the case of virt-admin.srv-list Signed-off-by: Lily Zhu --- .../monitor/virt-admin_srv-list.cfg | 9 +++++++++ .../virt-admin/monitor/virt-admin_srv-list.py | 20 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 libvirt/tests/cfg/virt-admin/monitor/virt-admin_srv-list.cfg create mode 100644 libvirt/tests/src/virt-admin/monitor/virt-admin_srv-list.py diff --git a/libvirt/tests/cfg/virt-admin/monitor/virt-admin_srv-list.cfg b/libvirt/tests/cfg/virt-admin/monitor/virt-admin_srv-list.cfg new file mode 100644 index 0000000000..ee49052b7e --- /dev/null +++ b/libvirt/tests/cfg/virt-admin/monitor/virt-admin_srv-list.cfg @@ -0,0 +1,9 @@ +- virt-admin.srv-list: + type = virt-admin_srv-list + start_vm = no + variants: + - admin: + server_name = "admin" + - libvirtd: + server_name = "libvirtd" + diff --git a/libvirt/tests/src/virt-admin/monitor/virt-admin_srv-list.py b/libvirt/tests/src/virt-admin/monitor/virt-admin_srv-list.py new file mode 100644 index 0000000000..473575e9d4 --- /dev/null +++ b/libvirt/tests/src/virt-admin/monitor/virt-admin_srv-list.py @@ -0,0 +1,20 @@ +import re +from autotest.client.shared import error + +from virttest import virtadmin + + +def run(test, params, env): + """ + Test command: virt-admin srv-list. + """ + server_name = params.get("server_name", "") + vp = virtadmin.VirtadminPersistent() + result = vp.srv_list(ignore_status=True, debug=True) + output = result.stdout.strip() + + if result.exit_status: + raise error.TestFail("This operation should success but failed!") + else: + if not re.search(server_name, output): + raise error.TestFail("server %s is not listed! ", server_name)