From 26a5056d5c41625c1f2e7ffc7fb16a5a9f379b02 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 25 Apr 2012 14:47:46 +0200 Subject: [PATCH] Add grow-disk tests in QA Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- qa/ganeti-qa.py | 4 +++- qa/qa-sample.json | 1 + qa/qa_instance.py | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index 91cd50649..9f12d3751 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -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) diff --git a/qa/qa-sample.json b/qa/qa-sample.json index 0cfdf2e0a..3deeda37d 100644 --- a/qa/qa-sample.json +++ b/qa/qa-sample.json @@ -106,6 +106,7 @@ "instance-export": true, "instance-failover": true, + "instance-grow-disk": true, "instance-import": true, "instance-info": true, "instance-list": true, diff --git a/qa/qa_instance.py b/qa/qa_instance.py index 9834c7544..2d0843a25 100644 --- a/qa/qa_instance.py +++ b/qa/qa_instance.py @@ -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()) -- GitLab