Commit 26a5056d authored by Iustin Pop's avatar Iustin Pop

Add grow-disk tests in QA

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent ef8270dc
......@@ -252,7 +252,7 @@ def RunCommonInstanceTests(instance):
RunTestIf(["instance-console", "rapi"],
qa_rapi.TestRapiInstanceConsole, instance)
DOWN_TESTS = ["instance-reinstall", "instance-rename"]
DOWN_TESTS = ["instance-reinstall", "instance-rename", "instance-grow-disk"]
# shutdown instance for any 'down' tests
RunTestIf(DOWN_TESTS, qa_instance.TestInstanceShutdown, instance)
......@@ -280,6 +280,8 @@ def RunCommonInstanceTests(instance):
RunTestIf("rapi", qa_rapi.TestRapiInstanceRenameAndBack,
rename_source, rename_target)
RunTestIf(["instance-grow-disk"], qa_instance.TestInstanceGrowDisk, instance)
# and now start the instance again
RunTestIf(DOWN_TESTS, qa_instance.TestInstanceStartup, instance)
......
......@@ -106,6 +106,7 @@
"instance-export": true,
"instance-failover": true,
"instance-grow-disk": true,
"instance-import": true,
"instance-info": true,
"instance-list": true,
......
......@@ -279,6 +279,28 @@ def TestInstanceConvertDisk(instance, snode):
"-n", snode["primary"], name])
def TestInstanceGrowDisk(instance):
"""gnt-instance grow-disk"""
name = instance["name"]
all_size = qa_config.get("disk")
all_grow = qa_config.get("disk-growth")
if not all_grow:
# missing disk sizes but instance grow disk has been enabled,
# let's set fixed/nomimal growth
all_grow = ["128M" for _ in all_size]
for idx, (size, grow) in enumerate(zip(all_size, all_grow)):
# succeed in grow by amount
AssertCommand(["gnt-instance", "grow-disk", name, str(idx), grow])
# fail in grow to the old size
AssertCommand(["gnt-instance", "grow-disk", "--absolute", name, str(idx),
size], fail=True)
# succeed to grow to old size + 2 * growth
int_size = utils.ParseUnit(size)
int_grow = utils.ParseUnit(grow)
AssertCommand(["gnt-instance", "grow-disk", "--absolute", name, str(idx),
str(int_size + 2 * int_grow)])
def TestInstanceList():
"""gnt-instance list"""
qa_utils.GenericQueryTest("gnt-instance", query.INSTANCE_FIELDS.keys())
......
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