From 92cb4940f3633e16bd4db757616210103dc1240a Mon Sep 17 00:00:00 2001 From: Andrea Spadaccini <spadaccio@google.com> Date: Thu, 5 Jan 2012 14:56:25 +0000 Subject: [PATCH] qa: fix disk parameters tests Fix an error in the disk parameters tests (the arguments to gnt-cluster were not passed correctly) and move them to separate functions. Signed-off-by: Andrea Spadaccini <spadaccio@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- qa/ganeti-qa.py | 2 ++ qa/qa_cluster.py | 37 ++++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index fc50a09f6..4d6c99eb3 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -155,11 +155,13 @@ def RunClusterTests(): """ for test, fn in [ + ("create-cluster", qa_cluster.TestClusterInitDisk), ("cluster-renew-crypto", qa_cluster.TestClusterRenewCrypto), ("cluster-verify", qa_cluster.TestClusterVerify), ("cluster-reserved-lvs", qa_cluster.TestClusterReservedLvs), # TODO: add more cluster modify tests ("cluster-modify", qa_cluster.TestClusterModifyBe), + ("cluster-modify", qa_cluster.TestClusterModifyDisk), ("cluster-rename", qa_cluster.TestClusterRename), ("cluster-info", qa_cluster.TestClusterVersion), ("cluster-info", qa_cluster.TestClusterInfo), diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index 28b8aef16..662460073 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -58,13 +58,22 @@ def _CheckFileOnAllNodes(filename, content): AssertEqual(qa_utils.GetCommandOutput(node["primary"], cmd), content) +# data for testing failures due to bad keys/values for disk parameters +_FAIL_PARAMS = ["nonexistent:resync-rate=1", + "drbd:nonexistent=1", + "drbd:resync-rate=invalid", + ] + + +def TestClusterInitDisk(): + """gnt-cluster init -D""" + name = qa_config.get("name") + for param in _FAIL_PARAMS: + AssertCommand(["gnt-cluster", "init", "-D", param, name], fail=True) + + def TestClusterInit(rapi_user, rapi_secret): """gnt-cluster init""" - # data for testing failures due to bad keys/values for disk parameters - fail_params = ("-D nonexistent:resync-rate=1", - "-D drbd:nonexistent=1", - "-D drbd:resync-rate=invalid") - master = qa_config.GetMasterNode() rapi_dir = os.path.dirname(constants.RAPI_USERS_FILE) @@ -110,22 +119,10 @@ def TestClusterInit(rapi_user, rapi_secret): if htype: cmd.append("--enabled-hypervisors=%s" % htype) - # test gnt-cluster init failures due to bad keys/values in disk parameters - for param in fail_params: - cmd.extend([param, qa_config.get("name")]) - AssertCommand(cmd, fail=True) - cmd.pop() - cmd.pop() - cmd.append(qa_config.get("name")) AssertCommand(cmd) cmd = ["gnt-cluster", "modify"] - # test gnt-cluster modify failures due to bad keys/values in disk parameters - for param in fail_params: - cmd.append(param) - AssertCommand(cmd, fail=True) - cmd.pop() # hypervisor parameter modifications hvp = qa_config.get("hypervisor-parameters", {}) @@ -279,6 +276,12 @@ def TestClusterReservedLvs(): AssertCommand(cmd, fail=fail) +def TestClusterModifyDisk(): + """gnt-cluster modify -D""" + for param in _FAIL_PARAMS: + AssertCommand(["gnt-cluster", "modify", "-D", param], fail=True) + + def TestClusterModifyBe(): """gnt-cluster modify -B""" for fail, cmd in [ -- GitLab