Skip to content
Snippets Groups Projects
Commit 92cb4940 authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

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: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 9f2c2103
No related branches found
No related tags found
No related merge requests found
......@@ -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),
......
......@@ -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 [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment