Skip to content
Snippets Groups Projects
Commit 2df92990 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

QA: Add virtual cluster support to queue drain test


The path to the queue drain file must use the virtual node path.

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarBernardo Dal Seno <bdalseno@google.com>
parent db41409c
No related branches found
No related tags found
No related merge requests found
...@@ -576,34 +576,48 @@ def TestClusterMasterFailover(): ...@@ -576,34 +576,48 @@ def TestClusterMasterFailover():
failovermaster.Release() failovermaster.Release()
def _NodeQueueDrainFile(node):
"""Returns path to queue drain file for a node.
"""
return qa_utils.MakeNodePath(node, pathutils.JOB_QUEUE_DRAIN_FILE)
def _AssertDrainFile(node, **kwargs):
"""Checks for the queue drain file.
"""
AssertCommand(["test", "-f", _NodeQueueDrainFile(node)], node=node, **kwargs)
def TestClusterMasterFailoverWithDrainedQueue(): def TestClusterMasterFailoverWithDrainedQueue():
"""gnt-cluster master-failover with drained queue""" """gnt-cluster master-failover with drained queue"""
drain_check = ["test", "-f", pathutils.JOB_QUEUE_DRAIN_FILE]
master = qa_config.GetMasterNode() master = qa_config.GetMasterNode()
failovermaster = qa_config.AcquireNode(exclude=master) failovermaster = qa_config.AcquireNode(exclude=master)
# Ensure queue is not drained # Ensure queue is not drained
for node in [master, failovermaster]: for node in [master, failovermaster]:
AssertCommand(drain_check, node=node, fail=True) _AssertDrainFile(node, fail=True)
# Drain queue on failover master # Drain queue on failover master
AssertCommand(["touch", pathutils.JOB_QUEUE_DRAIN_FILE], node=failovermaster) AssertCommand(["touch", _NodeQueueDrainFile(failovermaster)],
node=failovermaster)
cmd = ["gnt-cluster", "master-failover"] cmd = ["gnt-cluster", "master-failover"]
try: try:
AssertCommand(drain_check, node=failovermaster) _AssertDrainFile(failovermaster)
AssertCommand(cmd, node=failovermaster) AssertCommand(cmd, node=failovermaster)
AssertCommand(drain_check, fail=True) _AssertDrainFile(master, fail=True)
AssertCommand(drain_check, node=failovermaster, fail=True) _AssertDrainFile(failovermaster, fail=True)
# Back to original master node # Back to original master node
AssertCommand(cmd, node=master) AssertCommand(cmd, node=master)
finally: finally:
failovermaster.Release() failovermaster.Release()
AssertCommand(drain_check, fail=True) # Ensure queue is not drained
AssertCommand(drain_check, node=failovermaster, fail=True) for node in [master, failovermaster]:
_AssertDrainFile(node, fail=True)
def TestClusterCopyfile(): def TestClusterCopyfile():
......
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