Skip to content

Commit

Permalink
CBQE-1898 speed up teardown cluster by delete bucket
Browse files Browse the repository at this point in the history
before rebalance out nodes.

Change-Id: Ib1878f2dbbb1b10b096b760f7c9a87d63391fc4f
Reviewed-on: http://review.couchbase.org/83648
Reviewed-by: Thuan Nguyen <soccon@gmail.com>
Tested-by: Thuan Nguyen <soccon@gmail.com>
  • Loading branch information
saigon committed Sep 22, 2017
1 parent 122e644 commit ccf211c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/remote/remote_util.py
Expand Up @@ -3421,7 +3421,7 @@ def reset_env_variables(self):
file_path = "/opt/couchbase/etc/"
if self.info.type.lower() == "windows":
init_file = "service_start.bat"
file_path = "/cygdrive/c/Program Files/Couchbase/Server/bin"
file_path = "/cygdrive/c/Program\ Files/Couchbase/Server/bin/"
backupfile = file_path + init_file + ".bak"
sourceFile = file_path + init_file
o, r = self.execute_command("mv " + backupfile + " " + sourceFile)
Expand Down
1 change: 0 additions & 1 deletion pytests/rackzone/rackzone_base.py
Expand Up @@ -70,4 +70,3 @@ def tearDown(self):
for zone in zones:
if zone != "Group 1":
rest.delete_zone(zone)
super(RackzoneBaseTest, self).tearDown()
10 changes: 10 additions & 0 deletions pytests/rackzone/rackzonetests.py
Expand Up @@ -12,6 +12,7 @@
from couchbase_helper.documentgenerator import BlobGenerator
from remote.remote_util import RemoteMachineShellConnection
from membase.helper.cluster_helper import ClusterOperationHelper
from membase.helper.bucket_helper import BucketOperationHelper
from scripts.install import InstallerJob
from testconstants import COUCHBASE_VERSION_2
from testconstants import COUCHBASE_FROM_VERSION_3
Expand Down Expand Up @@ -204,6 +205,7 @@ def test_replica_distribution_in_zone(self):
self._verify_replica_distribution_in_zones(nodes_in_zone, "tap")

""" Simulate entire nodes down in zone(s) by killing erlang process"""
shutdown_nodes = []
if self.shutdown_zone >= 1 and self.zone >=2:
self.log.info("Start to shutdown nodes in zone to failover")
for down_zone in range(1, self.shutdown_zone + 1):
Expand All @@ -212,6 +214,7 @@ def test_replica_distribution_in_zone(self):
for si in self.servers:
if si.ip == sv:
server = si
shutdown_nodes.append(si)

shell = RemoteMachineShellConnection(server)
shell.kill_erlang(self.os_name)
Expand Down Expand Up @@ -244,6 +247,13 @@ def test_replica_distribution_in_zone(self):
raise
finally:
self.log.info("---> remove all nodes in all zones")
if shutdown_nodes:
for node in shutdown_nodes:
conn = RemoteMachineShellConnection(node)
self.log.info("---> re-start nodes %s after erlang killed " % node.ip)
conn.start_couchbase()
time.sleep(5)
BucketOperationHelper.delete_all_buckets_or_assert(self.servers, self)
ClusterOperationHelper.cleanup_cluster(self.servers, master=self.master)
self.log.info("---> remove all zones in cluster")
rm_zones = rest.get_zone_names()
Expand Down

0 comments on commit ccf211c

Please sign in to comment.