Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CBQE-2237: add hostname mgmt tests with cluster ops

Change-Id: Ie0f4d1ec19ea5d78c483e284d22270cc1ae3b306
Reviewed-on: http://review.couchbase.org/39352
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Iryna Mironava <irynamironava@yandex.ru>
  • Loading branch information...
commit af338ae6936d29f6e40099a0548f42c1a0cea301 1 parent 47649b9
@IrynaMironava IrynaMironava authored
View
3  conf/py-hostnameTests.conf
@@ -8,6 +8,9 @@ hostname.hostnamemgmt_tests.HostnameMgmtTests:
test_rename_with_warm_up
test_rename_negative,error=eaddrnotavail
test_rename_negative_name_with_space,error=Requested name hostname is not allowed
+ test_rename_rebalance_start_stop
+ test_rename_swap_rebalance
+ test_rename_failover_add_back
hostname.hostnamemgmt_multirenames_tests.HostnameMgmtMultiTests:
test_add_cluster_twice
test_add_same_node_to_cluster,use_names=2
View
64 pytests/hostname/hostnamemgmt_tests.py
@@ -1,6 +1,6 @@
from couchbase.document import View
from hostnamemgmt_base import HostnameBaseTests
-from membase.api.rest_client import RestConnection
+from membase.api.rest_client import RestConnection, RestHelper
from remote.remote_util import RemoteMachineShellConnection
class HostnameMgmtTests(HostnameBaseTests):
@@ -125,3 +125,65 @@ def test_rename_negative_name_with_space(self):
self.assertTrue(str(ex).find(self.error) != -1, "Unexpected error msg")
else:
raise ex
+
+ def test_rename_rebalance_start_stop(self):
+ expected_progress = self.input.param('expected_progress', 30)
+ if len(self.servers) < 2:
+ self.fail("test require more than 1 node")
+ hostnames = self.rename_nodes(self.servers[:self.nodes_in + self.nodes_init])
+ self._set_hostames_to_servers_objs(hostnames)
+ self.verify_referenced_by_names(self.servers[:self.nodes_in + self.nodes_init], hostnames)
+ rebalance = self.cluster.async_rebalance(self.servers[:self.nodes_init],
+ self.servers[self.nodes_init:self.nodes_in + self.nodes_init], [],
+ use_hostnames=True)
+ self.sleep(3, 'wait for some progress in rebalance...')
+ rest = RestConnection(self.master)
+ reached = RestHelper(rest).rebalance_reached(expected_progress)
+ self.assertTrue(reached, "rebalance failed or did not reach {0}%".format(expected_progress))
+ if not RestHelper(rest).is_cluster_rebalanced():
+ stopped = rest.stop_rebalance(wait_timeout=self.wait_timeout / 3)
+ self.assertTrue(stopped, msg="unable to stop rebalance")
+ self.verify_referenced_by_names(self.servers[:self.nodes_in + self.nodes_init], hostnames)
+ self.cluster.rebalance(self.servers[:self.nodes_init + self.nodes_init],
+ [], [], use_hostnames=True)
+ self.verify_referenced_by_names(self.servers[:self.nodes_in + self.nodes_init], hostnames)
+
+ def test_rename_swap_rebalance(self):
+ if len(self.servers) < 3:
+ self.fail("test require more than 2 nodes")
+ hostnames = self.rename_nodes(self.servers[:self.nodes_in + self.nodes_init + self.nodes_out])
+ self._set_hostames_to_servers_objs(hostnames)
+ self.verify_referenced_by_names(self.servers[:self.nodes_in + self.nodes_init + self.nodes_out], hostnames)
+ self.cluster.rebalance(self.servers[:self.nodes_init],
+ self.servers[self.nodes_init:self.nodes_in + self.nodes_init], [],
+ use_hostnames=True)
+ self.verify_referenced_by_names(self.servers[:self.nodes_in + self.nodes_init + self.nodes_out], hostnames)
+ rebalance = self.cluster.rebalance(self.servers[self.nodes_init:self.nodes_in + self.nodes_init],
+ self.servers[self.nodes_in + self.nodes_init:self.nodes_in + self.nodes_init + self.nodes_out],
+ self.servers[self.nodes_init:self.nodes_in + self.nodes_init],
+ use_hostnames=True)
+ self.verify_referenced_by_names(self.servers[:self.nodes_in + self.nodes_init + self.nodes_out], hostnames)
+
+ def test_rename_failover_add_back(self):
+ if len(self.servers) < 2:
+ self.fail("test require more than 1 node")
+ failover_factor = self.input.param("failover-factor", 1)
+ failover_nodes = self.servers[self.nodes_in : self.nodes_in + failover_factor + 1]
+ hostnames = self.rename_nodes(self.servers[:self.nodes_in + failover_factor + 1])
+ self._set_hostames_to_servers_objs(hostnames)
+ self.verify_referenced_by_names(self.servers[:self.nodes_in + failover_factor + 1], hostnames)
+ self.cluster.rebalance(self.servers[:self.nodes_init],
+ self.servers[self.nodes_init:self.nodes_in + failover_factor + 1], [],
+ use_hostnames=True)
+ rest = RestConnection(self.master)
+ nodes_all = rest.node_statuses()
+ nodes = []
+ for failover_node in failover_nodes:
+ nodes.extend([node for node in nodes_all
+ if node.ip != failover_node.ip or str(node.port) != failover_node.port])
+ self.cluster.failover(self.servers, failover_nodes)
+ self.verify_referenced_by_names(self.servers[:self.nodes_in + failover_factor + 1], hostnames)
+ for node in nodes:
+ rest.add_back_node(node.id)
+ self.cluster.rebalance(self.servers[:self.nodes_in + failover_factor + 1], [], [], use_hostnames=True)
+ self.verify_referenced_by_names(self.servers[:self.nodes_in + failover_factor + 1], hostnames)
Please sign in to comment.
Something went wrong with that request. Please try again.