Commit c0f74c55 authored by Iustin Pop's avatar Iustin Pop

Add QA tests for gnt-instance modify

This patch adds QA tests for most of the possible parameters in the
instance modify operation (exception being the MAC), and modifies the
sample QA file to run this test.

It also tests the no-modification test, but that is a weak one: we only
test that the exit code is one, not that the command gave a proper
response ("... please give at least one parameter") as opposed to a
traceback.

Reviewed-by: imsnah
parent d6d415e8
......@@ -137,6 +137,9 @@ def RunCommonInstanceTests(instance):
if qa_config.TestEnabled('instance-info'):
RunTest(qa_instance.TestInstanceInfo, instance)
if qa_config.TestEnabled('instance-modify'):
RunTest(qa_instance.TestInstanceModify, instance)
if qa_config.TestEnabled('instance-reinstall'):
RunTest(qa_instance.TestInstanceShutdown, instance)
RunTest(qa_instance.TestInstanceReinstall, instance)
......
......@@ -58,6 +58,7 @@ tests:
instance-list: True
instance-failover: True
instance-info: True
instance-modify: True
instance-export: True
instance-import: True
instance-reinstall: True
......
......@@ -151,6 +151,39 @@ def TestInstanceInfo(instance):
utils.ShellQuoteArgs(cmd)).wait(), 0)
@qa_utils.DefineHook('instance-modify')
def TestInstanceModify(instance):
"""gnt-instance modify"""
master = qa_config.GetMasterNode()
orig_memory = qa_config.get('mem')
orig_bridge = qa_config.get('bridge', 'xen-br0')
args = [
["--memory", "128"],
["--memory", str(orig_memory)],
["--cpu", "2"],
["--cpu", "1"],
["--bridge", "xen-br1"],
["--bridge", orig_bridge],
["--kernel", "/dev/null"],
["--kernel", "default"],
["--initrd", "/dev/null"],
["--initrd", "none"],
["--initrd", "default"],
["--hvm-boot-order", "acn"],
["--hvm-boot-order", "default"],
]
for alist in args:
cmd = ['gnt-instance', 'modify'] + alist + [instance['name']]
AssertEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
# check no-modify
cmd = ['gnt-instance', 'modify', instance['name']]
AssertNotEqual(StartSSH(master['primary'],
utils.ShellQuoteArgs(cmd)).wait(), 0)
@qa_utils.DefineHook('instance-list')
def TestInstanceList():
"""gnt-instance list"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment