本文整理汇总了Python中membase.api.rest_client.RestConnection.get_nodes_version方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.get_nodes_version方法的具体用法?Python RestConnection.get_nodes_version怎么用?Python RestConnection.get_nodes_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.get_nodes_version方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_nodes_version [as 别名]
def load(self, server, items, bucket,start_at=0,batch=1000):
import subprocess
from lib.testconstants import COUCHBASE_FROM_SPOCK
rest = RestConnection(server)
num_cycles = int((items / batch )) / 5
cmd = "cbc-pillowfight -U couchbase://{0}/{3} -I {1} -m 10 -M 100 -B {2} --populate-only --start-at {4} --json".format(server.ip, items, batch,bucket,start_at)
if rest.get_nodes_version()[:5] in COUCHBASE_FROM_SPOCK:
cmd += " -u Administrator -P password"
self.log.info("Executing '{0}'...".format(cmd))
rc = subprocess.call(cmd, shell=True)
if rc != 0:
self.fail("Exception running cbc-pillowfight: subprocess module returned non-zero response!")
示例2: CommunityBaseTest
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_nodes_version [as 别名]
class CommunityBaseTest(BaseTestCase):
def setUp(self):
super(CommunityBaseTest, self).setUp()
self.product = self.input.param("product", "cb")
self.vbuckets = self.input.param("vbuckets", 128)
self.version = self.input.param("version", "2.5.1-1082")
self.type = self.input.param('type', 'community')
self.doc_ops = self.input.param("doc_ops", None)
if self.doc_ops is not None:
self.doc_ops = self.doc_ops.split(";")
self.defaul_map_func = "function (doc) {\n emit(doc._id, doc);\n}"
self.couchbase_login = "%s:%s" % (self.input.membase_settings.rest_username,
self.input.membase_settings.rest_password)
self.backup_option = self.input.param("backup_option", '')
#define the data that will be used to test
self.blob_generator = self.input.param("blob_generator", True)
self.rest = RestConnection(self.master)
if self.rest.is_enterprise_edition():
raise Exception("This couchbase server is not Community Edition."
"Tests require Community Edition to test")
self.version = self.rest.get_nodes_version()[:5]
if self.blob_generator:
#gen_load data is used for upload before each test(1000 items by default)
self.gen_load = BlobGenerator('test', 'test-', self.value_size, end=self.num_items)
#gen_update is used for doing mutation for 1/2th of uploaded data
self.gen_update = BlobGenerator('test', 'test-', self.value_size, end=(self.num_items / 2 - 1))
#upload data before each test
self._load_all_buckets(self.servers[0], self.gen_load, "create", 0)
else:
self._load_doc_data_all_buckets()
self.remote = RemoteMachineShellConnection(self.master)
type = self.remote.extract_remote_info().distribution_type
self.backup_location = LINUX_BACKUP_PATH
self.backup_c_location = LINUX_BACKUP_PATH
self.bin_path = LINUX_COUCHBASE_BIN_PATH
self.file_extension = ""
if type.lower() == 'windows':
self.is_linux = False
self.backup_location = WIN_BACKUP_PATH
self.backup_c_location = WIN_BACKUP_C_PATH
self.bin_path = WIN_COUCHBASE_BIN_PATH
self.file_extension = ".exe"
else:
self.is_linux = True
def tearDown(self):
""" Some test involve kill couchbase server. If the test steps failed
right after kill erlang process, we need to start couchbase server
in teardown so that the next test will not be false failed """
super(CommunityBaseTest, self).tearDown()
示例3: load
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_nodes_version [as 别名]
def load(self, server, items, batch=1000):
import subprocess
from lib.testconstants import COUCHBASE_FROM_SPOCK
rest = RestConnection(server)
cmd = "cbc version"
rc = subprocess.call(cmd, shell=True)
if rc != 0:
self.fail("Exception running cbc-version: subprocess module returned non-zero response!")
cmd = "cbc-pillowfight -U couchbase://{0}/default -I {1} -M 50 -B 1000 --populate-only --json" \
.format(server.ip, items, batch)
if rest.get_nodes_version()[:5] in COUCHBASE_FROM_SPOCK:
cmd += " -u Administrator -P password"
self.log.info("Executing '{0}'...".format(cmd))
rc = subprocess.call(cmd, shell=True)
if rc != 0:
self.fail("Exception running cbc-pillowfight: subprocess module returned non-zero response!")
示例4: CreateBucketTests
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_nodes_version [as 别名]
class CreateBucketTests(BaseTestCase):
def setUp(self):
super(CreateBucketTests, self).setUp()
self._init_parameters()
def _init_parameters(self):
self.bucket_name = self.input.param("bucket_name", 'default')
self.bucket_type = self.input.param("bucket_type", 'sasl')
self.bucket_size = self.quota
self.password = 'password'
self.server = self.master
self.rest = RestConnection(self.server)
self.node_version = self.rest.get_nodes_version()
self.total_items_travel_sample = 31569
if self.node_version[:5] in COUCHBASE_FROM_WATSON:
self.total_items_travel_sample = 31591
shell = RemoteMachineShellConnection(self.master)
type = shell.extract_remote_info().distribution_type
shell.disconnect()
self.sample_path = LINUX_COUCHBASE_SAMPLE_PATH
self.bin_path = LINUX_COUCHBASE_BIN_PATH
if type.lower() == 'windows':
self.sample_path = WIN_COUCHBASE_SAMPLE_PATH
self.bin_path = WIN_COUCHBASE_BIN_PATH
elif type.lower() == "mac":
self.sample_path = MAC_COUCHBASE_SAMPLE_PATH
self.bin_path = MAC_COUCHBASE_BIN_PATH
def tearDown(self):
super(CreateBucketTests, self).tearDown()
# Bucket creation with names as mentioned in MB-5844(.delete, _replicator.couch.1, _users.couch.1)
def test_banned_bucket_name(self, password='password'):
try:
if self.bucket_type == 'sasl':
self.rest.create_bucket(self.bucket_name, authType='sasl', saslPassword=password, ramQuotaMB=200)
elif self.bucket_type == 'standard':
self.rest.create_bucket(self.bucket_name, ramQuotaMB=200, proxyPort=STANDARD_BUCKET_PORT + 1)
elif self.bucket_type == 'memcached':
self.rest.create_bucket(self.bucket_name, ramQuotaMB=200, proxyPort=STANDARD_BUCKET_PORT + 1, bucketType='memcached')
else:
self.log.error('Bucket type not specified')
return
self.fail('created a bucket with invalid name {0}'.format(self.bucket_name))
except BucketCreationException as ex:
self.log.info(ex)
def test_win_specific_names(self):
version = self._get_cb_version()
if self._get_cb_os() != 'windows':
self.log.warn('This test is windows specific')
return
try:
self.test_banned_bucket_name()
finally:
try:
self.log.info('Will check if ns_server is running')
rest = RestConnection(self.master)
self.assertTrue(RestHelper(rest).is_ns_server_running(timeout_in_seconds=60))
except:
self._reinstall(version)
self.fail("ns_server is not running after bucket '%s' creation" %(
self.bucket_name))
def test_create_bucket_used_port(self):
ports = [25, 68, 80, 135, 139, 143, 500]
for port in ports:
try:
self.cluster.create_standard_bucket(self.server, self.bucket_name + str(port), port, self.bucket_size, self.num_replicas)
except:
self.log.info('Error appears as expected')
rest = RestConnection(self.master)
self.assertTrue(RestHelper(rest).is_ns_server_running(timeout_in_seconds=60))
else:
raise Exception('User has to be unable to create a bucket using port %s' % port)
# Bucket creation with names as mentioned in MB-5844(isasl.pw, ns_log)
def test_valid_bucket_name(self, password='password'):
tasks = []
if self.bucket_type == 'sasl':
self.cluster.create_sasl_bucket(self.server, self.bucket_name, password, self.num_replicas, self.bucket_size)
self.buckets.append(Bucket(name=self.bucket_name, authType="sasl", saslPassword=password, num_replicas=self.num_replicas,
bucket_size=self.bucket_size, master_id=self.server))
elif self.bucket_type == 'standard':
self.cluster.create_standard_bucket(self.server, self.bucket_name, STANDARD_BUCKET_PORT + 1, self.bucket_size, self.num_replicas)
self.buckets.append(Bucket(name=self.bucket_name, authType=None, saslPassword=None, num_replicas=self.num_replicas,
bucket_size=self.bucket_size, port=STANDARD_BUCKET_PORT + 1, master_id=self.server))
elif self.bucket_type == "memcached":
tasks.append(self.cluster.async_create_memcached_bucket(self.server, self.bucket_name, STANDARD_BUCKET_PORT + 1,
self.bucket_size, self.num_replicas))
self.buckets.append(Bucket(name=self.bucket_name, authType=None, saslPassword=None, num_replicas=self.num_replicas,
bucket_size=self.bucket_size, port=STANDARD_BUCKET_PORT + 1 , master_id=self.server, type='memcached'))
for task in tasks:
task.result()
else:
self.log.error('Bucket type not specified')
return
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(self.bucket_name, self.rest),
msg='failed to start up bucket with name "{0}'.format(self.bucket_name))
gen_load = BlobGenerator('buckettest', 'buckettest-', self.value_size, start=0, end=self.num_items)
#.........这里部分代码省略.........
示例5: epctlTests
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_nodes_version [as 别名]
class epctlTests(CliBaseTest):
def setUp(self):
super(epctlTests, self).setUp()
#You have 3 choices: start, stop, drain
self.persistence = self.input.param("persistence_choice", "")
#You have 3 choices: checkpoint_param,flush_param,tap_param
self.param_type = self.input.param("param_type", "set flush_param")
self.param = self.input.param("param", "max_size")
self.param_value = self.input.param("param_value", 1000000)
self.server = self.master
self.rest = RestConnection(self.server)
self.node_version = self.rest.get_nodes_version()
def tearDown(self):
super(epctlTests, self).tearDown()
def epctl_test(self):
"""We use cbepctl to do persistence or set param operatoins and verify
verify the result by checking the command output"""
for bucket in self.buckets:
if self.node_version[:5] in COUCHBASE_FROM_WATSON:
if self.param == "item_num_based_new_chk":
self.param_value = "true"
""" from Watson, there is not tap_throttle_threshold param """
if self.param == "tap_throttle_threshold":
self.param = "replication_throttle_threshold"
if self.persistence == "start":
output, error = self.shell.execute_cbepctl(bucket, "stop",
self.param_type,
self.param,
self.param_value)
output, error = self.shell.execute_cbepctl(bucket, self.persistence,
self.param_type,
self.param,
self.param_value)
self.verify_results(output, error)
def verify_results(self, output, error):
if len(error) > 0 :
raise Exception("Command throw out error message. "
"Please check the output of remote_util")
if self.persistence != "":
if output[0].find("Error") != -1:
raise Exception("Command throw out error message. "
"Please check the output of remote_util")
if self.persistence == "start":
if output[0].find("Persistence started") == -1:
raise Exception("Persistence start failed")
elif self.persistence == "stop":
if output[0].find("Persistence stopped") == -1:
raise Exception("Persistence stop failed")
elif self.persistence == "drain":
if output[0].find("done") == -1:
raise Exception("wait until queues are drained operation failed")
else:
if output[1].find("Error") != -1:
raise Exception("Command throw out error message. "
"Please check the output of remote_util")
if output[1].find(self.param) == -1 or \
output[1].find(str(self.param_value)) == -1:
raise Exception("set %s failed" % (self.param))