本文整理汇总了Python中membase.api.rest_client.RestConnection.get_autofailover_settings方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.get_autofailover_settings方法的具体用法?Python RestConnection.get_autofailover_settings怎么用?Python RestConnection.get_autofailover_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.get_autofailover_settings方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_max_nodes_1
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
def test_max_nodes_1(self):
max_nodes = 1
log = logger.Logger.get_logger()
self._cluster_setup()
master = self._servers[0]
rest = RestConnection(master)
rest.update_autofailover_settings(True, 30, max_nodes)
#it should have
#read settings and verify
rest.get_autofailover_settings()
log.info("set max_nodes to {0}".format(max_nodes))
示例2: test_enable
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
def test_enable(self):
self._cluster_setup()
master = self._servers[0]
rest = RestConnection(master)
rest.update_autofailover_settings("true", 30, 1)
#read settings and verify
settings = rest.get_autofailover_settings()
self.assertEquals(settings.enabled, True)
示例3: test_timeout_1_hour
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
def test_timeout_1_hour(self):
self._cluster_setup()
master = self._servers[0]
rest = RestConnection(master)
rest.update_autofailover_settings(True, 3600, 1)
#read settings and verify
settings = rest.get_autofailover_settings()
self.assertTrue(settings.timeout > 0)
示例4: test_negative_timeout
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
def test_negative_timeout(self):
self._cluster_setup()
master = self._servers[0]
rest = RestConnection(master)
rest.update_autofailover_settings(False, -60, 1)
#read settings and verify
settings = rest.get_autofailover_settings()
self.assertTrue(settings.timeout > 0)
示例5: test_disable
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
def test_disable(self):
# AUTOFAIL_TEST_2
self._cluster_setup()
master = self._servers[0]
rest = RestConnection(master)
rest.update_autofailover_settings(False, 60)
#read settings and verify
settings = rest.get_autofailover_settings()
self.assertEquals(settings.enabled, False)
示例6: test_negative_max_nodes
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
def test_negative_max_nodes(self):
self._cluster_setup()
master = self._servers[0]
rest = RestConnection(master)
rest.update_autofailover_settings(True, 30, -1)
#it should have
#read settings and verify
settings = rest.get_autofailover_settings()
self.assertFalse(settings)
示例7: test_timeout_valid_mins
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
def test_timeout_valid_mins(self):
self._cluster_setup()
master = self._servers[0]
rest = RestConnection(master)
mins = [30, 60, 90, 120, 180, 240]
for min in mins:
rest.update_autofailover_settings(True, 3600, 1)
#read settings and verify
settings = rest.get_autofailover_settings()
self.assertEquals(settings.timeout, min)
示例8: test_invalid_timeouts
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
def test_invalid_timeouts(self):
# AUTOFAIL_TESTN_1
self._cluster_setup()
master = self._servers[0]
rest = RestConnection(master)
timeouts = [-360, -60, 0, 15, 29]
for timeout in timeouts:
rest.update_autofailover_settings(True, timeout)
#read settings and verify
settings = rest.get_autofailover_settings()
self.assertTrue(settings.timeout >= 30)
示例9: test_valid_timeouts
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
def test_valid_timeouts(self):
# AUTOFAIL_TEST_3
self._cluster_setup()
master = self._servers[0]
rest = RestConnection(master)
timeouts = [30, 31, 300, 3600, 300000]
for timeout in timeouts:
rest.update_autofailover_settings(True, timeout)
#read settings and verify
settings = rest.get_autofailover_settings()
self.assertTrue(settings.timeout==timeout)
示例10: AutoFailoverTests
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
class AutoFailoverTests(unittest.TestCase):
def setUp(self):
self._input = TestInputSingleton.input
self.case_number = self._input.param("case_number", 0)
self._servers = self._input.servers
self.log = logger.Logger().get_logger()
self.master = self._servers[0]
self.rest = RestConnection(self.master)
self.timeout = 60
AutoFailoverBaseTest.common_setup(self._input, self)
self._cluster_setup()
def tearDown(self):
AutoFailoverBaseTest.common_tearDown(self._servers, self)
def sleep(self, timeout=1, message=""):
self.log.info("sleep for {0} secs. {1} ...".format(timeout, message))
time.sleep(timeout)
def test_enable(self):
status = self.rest.update_autofailover_settings(True, self.timeout / 2)
if not status:
self.fail('failed to change autofailover_settings! See MB-7282')
#read settings and verify
settings = self.rest.get_autofailover_settings()
self.assertEquals(settings.enabled, True)
def test_disable(self):
status = self.rest.update_autofailover_settings(False, self.timeout)
if not status:
self.fail('failed to change autofailover_settings! See MB-7282')
#read settings and verify
settings = self.rest.get_autofailover_settings()
self.assertEquals(settings.enabled, False)
def test_valid_timeouts(self):
timeouts = [30, 31, 300, 3600]
for timeout in timeouts:
status = self.rest.update_autofailover_settings(True, timeout)
if not status:
self.fail('failed to change autofailover_settings! See MB-7282')
#read settings and verify
settings = self.rest.get_autofailover_settings()
self.assertTrue(settings.timeout == timeout)
def test_30s_timeout_firewall(self):
timeout = self.timeout / 2
server_fail = self._servers[1]
status = self.rest.update_autofailover_settings(True, timeout)
if not status:
self.fail('failed to change autofailover_settings! See MB-7282')
self.sleep(5)
RemoteUtilHelper.enable_firewall(server_fail)
AutoFailoverBaseTest.wait_for_failover_or_assert(self.master, 1, timeout + AutoFailoverBaseTest.MAX_FAIL_DETECT_TIME, self)
def test_60s_timeout_firewall(self):
timeout = self.timeout
server_fail = self._servers[1]
status = self.rest.update_autofailover_settings(True, timeout)
if not status:
self.fail('failed to change autofailover_settings! See MB-7282')
self.sleep(5)
RemoteUtilHelper.enable_firewall(server_fail)
AutoFailoverBaseTest.wait_for_failover_or_assert(self.master, 1, timeout + AutoFailoverBaseTest.MAX_FAIL_DETECT_TIME, self)
def test_30s_timeout_stop(self):
timeout = self.timeout
server_fail = self._servers[1]
status = self.rest.update_autofailover_settings(True, timeout)
if not status:
self.fail('failed to change autofailover_settings! See MB-7282')
self.sleep(5)
self._stop_couchbase(server_fail)
AutoFailoverBaseTest.wait_for_failover_or_assert(self.master, 1, timeout + AutoFailoverBaseTest.MAX_FAIL_DETECT_TIME, self)
def test_60s_timeout_stop(self):
timeout = self.timeout
server_fail = self._servers[1]
status = self.rest.update_autofailover_settings(True, timeout)
if not status:
self.fail('failed to change autofailover_settings! See MB-7282')
self.sleep(5)
self._stop_couchbase(server_fail)
AutoFailoverBaseTest.wait_for_failover_or_assert(self.master, 1, timeout + AutoFailoverBaseTest.MAX_FAIL_DETECT_TIME, self)
def test_reset_count(self):
timeout = self.timeout / 2
server_fail1 = self._servers[1]
server_fail2 = self._servers[2]
status = self.rest.update_autofailover_settings(True, timeout)
if not status:
self.fail('failed to change autofailover_settings! See MB-7282')
self.sleep(5)
self.log.info("stopping the first server")
self._stop_couchbase(server_fail1)
AutoFailoverBaseTest.wait_for_failover_or_assert(self.master, 1, timeout + AutoFailoverBaseTest.MAX_FAIL_DETECT_TIME, self)
self.log.info("resetting the autofailover count")
if not self.rest.reset_autofailover():
self.fail('failed to reset autofailover count!')
#.........这里部分代码省略.........
示例11: AutoFailoverBaseTest
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_autofailover_settings [as 别名]
class AutoFailoverBaseTest(BaseTestCase):
MAX_FAIL_DETECT_TIME = 120
ORCHESTRATOR_TIMEOUT_BUFFER = 60
def setUp(self):
super(AutoFailoverBaseTest, self).setUp()
self._get_params()
self.rest = RestConnection(self.orchestrator)
self.task_manager = TaskManager("Autofailover_thread")
self.task_manager.start()
self.node_failure_task_manager = TaskManager(
"Nodes_failure_detector_thread")
self.node_failure_task_manager.start()
self.initial_load_gen = BlobGenerator('auto-failover',
'auto-failover-',
self.value_size,
end=self.num_items)
self.update_load_gen = BlobGenerator('auto-failover',
'auto-failover-',
self.value_size,
end=self.update_items)
self.delete_load_gen = BlobGenerator('auto-failover',
'auto-failover-',
self.value_size,
start=self.update_items,
end=self.delete_items)
self._load_all_buckets(self.servers[0], self.initial_load_gen,
"create", 0)
self._async_load_all_buckets(self.orchestrator,
self.update_load_gen, "update", 0)
self._async_load_all_buckets(self.orchestrator,
self.delete_load_gen, "delete", 0)
self.server_to_fail = self._servers_to_fail()
self.servers_to_add = self.servers[self.nodes_init:self.nodes_init +
self.nodes_in]
self.servers_to_remove = self.servers[self.nodes_init -
self.nodes_out:self.nodes_init]
# self.node_monitor_task = self.start_node_monitors_task()
def tearDown(self):
self.log.info("============AutoFailoverBaseTest teardown============")
self._get_params()
self.task_manager = TaskManager("Autofailover_thread")
self.task_manager.start()
self.server_to_fail = self._servers_to_fail()
self.start_couchbase_server()
self.sleep(10)
self.disable_firewall()
self.rest = RestConnection(self.orchestrator)
self.rest.reset_autofailover()
self.disable_autofailover()
self._cleanup_cluster()
super(AutoFailoverBaseTest, self).tearDown()
if hasattr(self, "node_monitor_task"):
if self.node_monitor_task._exception:
self.fail("{}".format(self.node_monitor_task._exception))
self.node_monitor_task.stop = True
self.task_manager.shutdown(force=True)
def enable_autofailover(self):
"""
Enable the autofailover setting with the given timeout.
:return: True If the setting was set with the timeout, else return
False
"""
status = self.rest.update_autofailover_settings(True,
self.timeout)
return status
def disable_autofailover(self):
"""
Disable the autofailover setting.
:return: True If the setting was disabled, else return
False
"""
status = self.rest.update_autofailover_settings(False, 120)
return status
def enable_autofailover_and_validate(self):
"""
Enable autofailover with given timeout and then validate if the
settings.
:return: Nothing
"""
status = self.enable_autofailover()
self.assertTrue(status, "Failed to enable autofailover_settings!")
self.sleep(5)
settings = self.rest.get_autofailover_settings()
self.assertTrue(settings.enabled, "Failed to enable "
"autofailover_settings!")
self.assertEqual(self.timeout, settings.timeout,
"Incorrect timeout set. Expected timeout : {0} "
"Actual timeout set : {1}".format(self.timeout,
settings.timeout))
def disable_autofailover_and_validate(self):
"""
Disable autofailover setting and then validate if the setting was
disabled.
:return: Nothing
#.........这里部分代码省略.........