本文整理汇总了Python中membase.api.rest_client.RestConnection.update_autofailover_settings方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.update_autofailover_settings方法的具体用法?Python RestConnection.update_autofailover_settings怎么用?Python RestConnection.update_autofailover_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.update_autofailover_settings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_reset_count
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_autofailover_settings [as 别名]
def test_reset_count(self):
# AUTOFAIL_TEST_8
timeout = 30
self._cluster_setup()
master = self._servers[0]
server_fail1 = self._servers[1]
server_fail2 = self._servers[2]
rest = RestConnection(master)
rest.update_autofailover_settings(True, timeout)
self.log.info("stopping the first server")
time_start = time.time()
self._stop_couchbase(server_fail1)
AutoFailoverBaseTest.wait_for_failover_or_assert(master, 1, timeout, self)
time_end = time.time()
msg = "{0} != {1}".format(time_end-time_start, timeout)
self.assertTrue(abs((time_end-time_start) - timeout) <= AutoFailoverBaseTest.MAX_FAIL_DETECT_TIME, msg)
self.log.info("expected failover in {0} seconds, actual time {1} seconds".format(timeout, time_end-time_start))
self.log.info("resetting the autofailover count")
rest.reset_autofailover()
self.log.info("stopping the second server")
time_start = time.time()
self._stop_couchbase(server_fail2)
AutoFailoverBaseTest.wait_for_failover_or_assert(master, 2, timeout, self)
time_end = time.time()
msg = "{0} != {1}".format(time_end-time_start, timeout)
self.assertTrue(abs((time_end-time_start) - timeout) <= AutoFailoverBaseTest.MAX_FAIL_DETECT_TIME, msg)
self.log.info("expected failover in {0} seconds, actual time {1} seconds".format(timeout, time_end-time_start))
示例2: test_add_remove_autofailover
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_autofailover_settings [as 别名]
def test_add_remove_autofailover(self):
rest = RestConnection(self.master)
serv_out = self.servers[3]
shell = RemoteMachineShellConnection(serv_out)
known_nodes = ['[email protected]'+self.master.ip]
rest.create_bucket(bucket='default', ramQuotaMB=100)
rest.update_autofailover_settings(True,30)
x509main(self.master).setup_master()
x509main().setup_cluster_nodes_ssl(self.servers[1:4])
for server in self.servers[1:4]:
rest.add_node('Administrator','password',server.ip)
known_nodes.append('[email protected]'+server.ip)
rest.rebalance(known_nodes)
self.assertTrue(self.check_rebalance_complete(rest),"Issue with rebalance")
shell.stop_server()
self.sleep(60)
shell.start_server()
self.sleep(30)
for server in self.servers:
status = x509main(server)._validate_ssl_login()
self.assertEqual(status,200,"Not able to login via SSL code")
示例3: test_negative_timeout
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_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)
示例4: test_enable
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_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)
示例5: test_timeout_1_hour
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_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)
示例6: test_disable
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_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)
示例7: test_negative_max_nodes
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_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)
示例8: test_timeout_valid_mins
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_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)
示例9: test_valid_timeouts
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_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: test_invalid_timeouts
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_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)
示例11: test_max_nodes_1
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_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))
示例12: test_eventDisabled
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_autofailover_settings [as 别名]
def test_eventDisabled(self):
disableEvent = self.input.param("disableEvent", None)
Audit = audit(host=self.master)
temp = Audit.getAuditConfigElement('all')
temp['disabled'] = [disableEvent]
Audit.writeFile(lines=temp)
rest = RestConnection(self.master)
rest.update_autofailover_settings(True, 120)
auditIns = audit(eventID=disableEvent, host=self.master)
status = auditIns.checkLastEvent()
self.assertFalse(status, "Event still getting printed after getting disabled")
示例13: test_60s_timeout_pause
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_autofailover_settings [as 别名]
def test_60s_timeout_pause(self):
# AUTOFAIL_TEST_10
timeout = 60
self._cluster_setup()
master = self._servers[0]
server_fail = self._servers[1]
rest = RestConnection(master)
rest.update_autofailover_settings(True, timeout)
time_start = time.time()
self._pause_couchbase(server_fail)
AutoFailoverBaseTest.wait_for_failover_or_assert(master, 1, timeout, self)
time_end = time.time()
msg = "{0} != {1}".format(time_end-time_start, timeout)
self.assertTrue(abs((time_end-time_start) - timeout) <= AutoFailoverBaseTest.MAX_FAIL_DETECT_TIME, msg)
self.log.info("expected failover in {0} seconds, actual time {1} seconds".format(timeout, time_end-time_start))
示例14: test_autofailover
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_autofailover_settings [as 别名]
def test_autofailover(self):
pre_recovery_tasks = self.async_run_operations(phase="before")
self._run_tasks([pre_recovery_tasks])
self.get_dgm_for_plasma()
kvOps_tasks = self._run_kvops_tasks()
autofailover_timeout = 30
conn = RestConnection(self.master)
status = conn.update_autofailover_settings(True, autofailover_timeout)
self.assertTrue(status, 'failed to change autofailover_settings!')
try:
self._create_replica_indexes()
servr_out = self.nodes_out_list
remote = RemoteMachineShellConnection(servr_out[0])
remote.stop_server()
self.sleep(10)
mid_recovery_tasks = self.async_run_operations(phase="in_between")
self.sleep(autofailover_timeout + 10, "Wait for autofailover")
rebalance = self.cluster.async_rebalance(
self.servers[:self.nodes_init], [], servr_out)
rebalance.result()
self._run_tasks([kvOps_tasks, mid_recovery_tasks])
#check if the nodes in cluster are healthy
msg = "Cluster not in Healthy state"
self.assertTrue(self.wait_until_cluster_is_healthy(), msg)
log.info("==== Cluster in healthy state ====")
self._check_all_bucket_items_indexed()
post_recovery_tasks = self.async_run_operations(phase="after")
self._run_tasks([post_recovery_tasks])
except Exception, ex:
log.info(str(ex))
raise
示例15: test_nwusage_with_auto_failover_and_bwthrottle_enabled
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import update_autofailover_settings [as 别名]
def test_nwusage_with_auto_failover_and_bwthrottle_enabled(self):
self.setup_xdcr()
self.src_cluster.rebalance_in()
nw_limit = self._input.param("nw_limit", 1)
self._set_nwusage_limit(self.src_cluster, nw_limit)
src_conn = RestConnection(self.src_cluster.get_master_node())
src_conn.update_autofailover_settings(enabled=True, timeout=30)
self.src_cluster.pause_all_replications()
gen_create = BlobGenerator('nwOne', 'nwOne', self._value_size, end=self._num_items)
self.src_cluster.load_all_buckets_from_generator(kv_gen=gen_create)
self.src_cluster.resume_all_replications()
self.sleep(15)
shell = RemoteMachineShellConnection(self._input.servers[1])
shell.stop_couchbase()
self.sleep(30)
task = self.cluster.async_rebalance(self.src_cluster.get_nodes(), [], [])
task.result()
failover_time = self._get_current_time(self.src_cluster.get_master_node())
self.log.info("Node auto failed over at {0}".format(failover_time))
FloatingServers._serverlist.append(self._input.servers[1])
self.sleep(15)
shell.start_couchbase()
shell.disable_firewall()
self.sleep(45)
self.src_cluster.rebalance_in()
node_back_time = self._get_current_time(self.src_cluster.get_master_node())
self.log.info("Node added back at {0}".format(node_back_time))
self._wait_for_replication_to_catchup(timeout=600)
self.verify_results()
self._verify_bandwidth_usage(node=self.src_cluster.get_master_node(), end_time=failover_time, no_of_nodes=3)
self._verify_bandwidth_usage(node=self.src_cluster.get_master_node(), event_time=failover_time, end_time=node_back_time, no_of_nodes=2)
self._verify_bandwidth_usage(node=self.src_cluster.get_master_node(), event_time=node_back_time, no_of_nodes=3)