Skip to content

Commit 9c927f4

Browse files
ashwin2002ShivamPaliwal1
authored andcommitted
Replacing monitorRebalance() with RebUtil().monitor_rebalance()
Change-Id: I918aa47f2d793bdb0eaafc74c89a472c84905e11 Reviewed-on: https://review.couchbase.org/c/TAF/+/245015 Reviewed-by: <shivam.paliwal@couchbase.com> Tested-by: <shivam.paliwal@couchbase.com>
1 parent d88fd02 commit 9c927f4

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

pytests/failover/DiskFailoverTests.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from custom_exceptions.exception import \
77
RebalanceFailedException, \
88
ServerUnavailableException
9+
from rebalance_utils.rebalance_util import RebalanceUtil
910

1011

1112
class DiskAutofailoverTests(DiskAutoFailoverBasetest):
@@ -257,7 +258,8 @@ def test_rebalance_after_disk_autofailover(self):
257258
started, _ = self.rest.rebalance(nodes, nodes_to_remove)
258259
rebalance_success = False
259260
if started:
260-
rebalance_success = self.rest.monitorRebalance()
261+
reb_util = RebalanceUtil(self.cluster)
262+
rebalance_success = reb_util.monitor_rebalance()
261263
if (not rebalance_success or not started) and not \
262264
self.failover_expected:
263265
self.fail("Rebalance failed. Check logs")
@@ -314,7 +316,8 @@ def test_disk_autofailover_and_addback_of_node(self):
314316
self.rest.rebalance(known_nodes=[node.id for node in self.nodes])
315317
msg = "rebalance failed while recovering failover nodes {0}".format(
316318
self.server_to_fail[0])
317-
self.assertTrue(self.rest.monitorRebalance(stop_if_loop=True), msg)
319+
reb_util = RebalanceUtil(self.cluster)
320+
self.assertTrue(reb_util.monitor_rebalance(stop_if_loop=True), msg)
318321
if self.spec_name is None:
319322
if not self.atomicity:
320323
self.validate_loadgen_tasks()
@@ -362,7 +365,8 @@ def test_disk_autofailover_and_remove_failover_node(self):
362365
eject_nodes=[])
363366
msg = "rebalance failed while removing failover nodes {0}".format(
364367
self.server_to_fail[0])
365-
self.assertTrue(self.rest.monitorRebalance(stop_if_loop=True), msg)
368+
reb_util = RebalanceUtil(self.cluster)
369+
self.assertTrue(reb_util.monitor_rebalance(stop_if_loop=True), msg)
366370
if self.spec_name is None:
367371
if not self.atomicity:
368372
self.validate_loadgen_tasks()

pytests/failover/MultiNodeAutoFailoverTests.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from custom_exceptions.exception import RebalanceFailedException, \
66
ServerUnavailableException
77
from membase.api.rest_client import RestConnection
8+
from rebalance_utils.rebalance_util import RebalanceUtil
89

910

1011
class MultiNodeAutoFailoverTests(AutoFailoverBaseTest):
@@ -195,7 +196,8 @@ def test_rebalance_after_autofailover(self):
195196
started, _ = self.rest.rebalance(known_nodes=nodes, eject_nodes=nodes_to_remove)
196197
rebalance_success = False
197198
if started:
198-
rebalance_success = self.rest.monitorRebalance()
199+
reb_util = RebalanceUtil(self.cluster)
200+
rebalance_success = reb_util.monitor_rebalance()
199201
if (not rebalance_success or not started) and not \
200202
self.failover_expected:
201203
self.fail("Rebalance failed. Check logs")
@@ -234,7 +236,8 @@ def test_autofailover_and_addback_of_node(self):
234236
self.rest.rebalance(known_nodes=[node.id for node in self.nodes])
235237
msg = "rebalance failed while recovering failover nodes {0}" \
236238
.format(self.server_to_fail[0])
237-
self.assertTrue(self.rest.monitorRebalance(stop_if_loop=True), msg)
239+
reb_util = RebalanceUtil(self.cluster)
240+
self.assertTrue(reb_util.monitor_rebalance(stop_if_loop=True), msg)
238241
if self.spec_name is None:
239242
for task in tasks:
240243
self.task.jython_task_manager.get_task_result(task)
@@ -265,8 +268,8 @@ def test_autofailover_and_remove_failover_node(self):
265268
self.rest.rebalance(known_nodes=[node.id for node in self.nodes])
266269
msg = "rebalance failed while removing failover nodes {0}" \
267270
.format(self.server_to_fail[0])
268-
self.assertTrue(self.rest.monitorRebalance(stop_if_loop=True),
269-
msg)
271+
reb_util = RebalanceUtil(self.cluster)
272+
self.assertTrue(reb_util.monitor_rebalance(stop_if_loop=True), msg)
270273
if self.spec_name is None:
271274
for task in tasks:
272275
self.task.jython_task_manager.get_task_result(task)

0 commit comments

Comments
 (0)