Add HA cases for rabbitmq and galera
- kill rabbitmq_server on random node
- kill mysql server on node with maximum mysql connections
Change-Id: I8cf1aab4a4213c339ddefcecaa86d9a80d52acdb
diff --git a/tcp_tests/managers/common_services_manager.py b/tcp_tests/managers/common_services_manager.py
index 1e783a8..c62114d 100644
--- a/tcp_tests/managers/common_services_manager.py
+++ b/tcp_tests/managers/common_services_manager.py
@@ -198,3 +198,31 @@
LOG.debug("keepalived pillars check passed: {0}".format(vips))
return vips
+
+ def get_haproxy_status(self, tgt):
+ """Get haproxy status for all backends on a specified minion"""
+ cmd = ("echo 'show stat' | "
+ "socat 'UNIX-CONNECT:/run/haproxy/admin.sock' STDIO")
+ # Refresh grains first
+ res = self._salt.run_state(tgt, 'cmd.run', cmd)
+ output = res[0]['return'][0]
+ assert len(output.keys()) == 1, "Please specify a single minion in tgt"
+ minion_id = output.keys()[0]
+
+ haproxy_status = {}
+ for line in output[minion_id].splitlines():
+ if line.startswith("#"):
+ continue
+ status = line.split(",")
+ pxname = status[0]
+ svname = status[1]
+ if pxname not in haproxy_status:
+ haproxy_status[pxname] = {}
+ haproxy_status[pxname][svname] = {
+ 'scur': status[4], # sessions current
+ 'smax': status[5], # sessions max
+ 'status': status[17], # status: UP or DOWN
+ 'rate': status[33], # sessions rate
+ }
+ LOG.debug("Haproxy status: \n{0}".format(haproxy_status))
+ return haproxy_status
diff --git a/tcp_tests/managers/underlay_ssh_manager.py b/tcp_tests/managers/underlay_ssh_manager.py
index 2008fba..7d3da96 100644
--- a/tcp_tests/managers/underlay_ssh_manager.py
+++ b/tcp_tests/managers/underlay_ssh_manager.py
@@ -363,12 +363,13 @@
with self.remote(node_name=host) as remote:
remote.upload(source, destination)
- def get_random_node(self):
+ def get_random_node(self, node_names=None):
"""Get random node name
+ :param node_names: list of strings
:return: str, name of node
"""
- return random.choice(self.node_names())
+ return random.choice(node_names or self.node_names())
def yaml_editor(self, file_path, node_name=None, host=None,
address_pool=None):