本文整理汇总了Python中membase.helper.bucket_helper.BucketOperationHelper.wait_for_bucket_creation方法的典型用法代码示例。如果您正苦于以下问题:Python BucketOperationHelper.wait_for_bucket_creation方法的具体用法?Python BucketOperationHelper.wait_for_bucket_creation怎么用?Python BucketOperationHelper.wait_for_bucket_creation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类membase.helper.bucket_helper.BucketOperationHelper
的用法示例。
在下文中一共展示了BucketOperationHelper.wait_for_bucket_creation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_default_moxi
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_default_moxi(self):
name = 'default'
for serverInfo in self.servers:
rest = RestConnection(serverInfo)
replicaNumber = 1
proxyPort = rest.get_nodes_self().moxi
rest.create_bucket(bucket=name,
ramQuotaMB=200,
replicaNumber=replicaNumber,
proxyPort=proxyPort)
msg = 'create_bucket succeeded but bucket {0} does not exist'.format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
ready = BucketOperationHelper.wait_for_memcached(serverInfo, name)
self.assertTrue(ready, "wait_for_memcached failed")
inserted_keys = BucketOperationHelper.load_some_data(serverInfo, 1, name)
self.assertTrue(inserted_keys, 'unable to insert any key to memcached')
verified = BucketOperationHelper.verify_data(serverInfo, inserted_keys, True, False, self, bucket=name)
self.assertTrue(verified, msg='verified all the keys stored')
#verify keys
rest.delete_bucket(name)
msg = 'bucket "{0}" was not deleted even after waiting for two minutes'.format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_deletion(name, rest, timeout_in_seconds=60), msg=msg)
rest.create_bucket(bucket=name,
ramQuotaMB=200,
replicaNumber=replicaNumber,
proxyPort=proxyPort)
msg = 'create_bucket succeeded but bucket {0} does not exist'.format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
BucketOperationHelper.wait_for_memcached(serverInfo, name)
#now let's recreate the bucket
self.log.info('recreated the default bucket...')
#loop over the keys make sure they dont exist
self.assertTrue(BucketOperationHelper.keys_dont_exist(serverInfo, inserted_keys, name),
msg='at least one key found in the bucket')
示例2: test_valid_bucket_name
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
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)
self._load_all_buckets(self.server, gen_load, "create", 0)
self.cluster.bucket_delete(self.server, self.bucket_name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_deletion(self.bucket_name, self.rest, timeout_in_seconds=60),
msg='bucket "{0}" was not deleted even after waiting for 30 seconds'.format(self.bucket_name))
示例3: test_non_default_case_sensitive_same_port
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_non_default_case_sensitive_same_port(self):
postfix = uuid.uuid4()
name = 'uppercase_{0}'.format(postfix)
master = self.servers[0]
rest = RestConnection(master)
proxyPort = rest.get_nodes_self().moxi + 100
shell = RemoteMachineShellConnection(master)
url = "http://%s:8091/pools/default/buckets" % master.ip
params = "name=%s&ramQuotaMB=200&authType=none&replicaNumber=1&proxyPort=%s" \
% (name, proxyPort)
cmd = "curl -X POST -u Administrator:password -d '%s' %s" % (params, url)
output, error = shell.execute_command(cmd)
if output and "error" in output[0]:
self.fail("Fail to create bucket %s" % name)
msg = 'create_bucket succeeded but bucket {0} does not exist'.format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
name = 'UPPERCASE{0}'.format(postfix)
params = "name=%s&ramQuotaMB=200&authType=none&replicaNumber=1&proxyPort=%s" \
% (name, proxyPort)
cmd = "curl -X POST -u Administrator:password -d '%s' %s" % (params, url)
output, error = shell.execute_command(cmd)
if output and 'port is already in use' not in output[0]:
self.log.error(output)
self.fail('create-bucket on same port failed as expected.')
示例4: setUp
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def setUp(self):
self.log = logger.Logger.get_logger()
self.master = TestInputSingleton.input.servers[0]
ClusterOperationHelper.cleanup_cluster([self.master])
BucketOperationHelper.delete_all_buckets_or_assert([self.master], self)
self._bucket_name = 'default'
serverInfo = self.master
rest = RestConnection(serverInfo)
info = rest.get_nodes_self()
self._bucket_port = info.moxi
rest.init_cluster(username=serverInfo.rest_username,
password=serverInfo.rest_password)
rest.init_cluster_memoryQuota(memoryQuota=info.mcdMemoryReserved)
bucket_ram = info.memoryQuota * 2 / 3
# Add built-in user
testuser = [{'id': 'cbadminbucket', 'name': 'cbadminbucket', 'password': 'password'}]
RbacBase().create_user_source(testuser, 'builtin', self.master)
time.sleep(10)
# Assign user to role
role_list = [{'id': 'cbadminbucket', 'name': 'cbadminbucket', 'roles': 'admin'}]
RbacBase().add_user_role(role_list, RestConnection(self.master), 'builtin')
time.sleep(10)
rest.create_bucket(bucket=self._bucket_name,
ramQuotaMB=bucket_ram,
proxyPort=info.memcached)
msg = 'create_bucket succeeded but bucket "default" does not exist'
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(self._bucket_name, rest), msg=msg)
ready = BucketOperationHelper.wait_for_memcached(serverInfo, self._bucket_name)
self.assertTrue(ready, "wait_for_memcached failed")
self._log_start()
示例5: test_default_case_sensitive_dedicated
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_default_case_sensitive_dedicated(self):
name = 'Default'
for serverInfo in self.servers:
rest = RestConnection(serverInfo)
proxyPort = rest.get_nodes_self().moxi
rest.create_bucket(bucket=name,
ramQuotaMB=200,
authType='sasl',
saslPassword='test_non_default',
proxyPort=proxyPort)
msg = 'create_bucket succeeded but bucket {0} does not exist'.format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
name = 'default'
try:
rest.create_bucket(bucket=name,
ramQuotaMB=200,
proxyPort=11221,
authType='sasl',
saslPassword='test_non_default')
msg = "create_bucket created two buckets in different case : {0},{1}".format('default', 'Default')
self.fail(msg)
except BucketCreationException as ex:
#check if 'default' and 'Default' buckets exist
self.log.info('BucketCreationException was thrown as expected')
self.log.info(ex.message)
示例6: test_default_moxi
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_default_moxi(self):
name = 'default'
for serverInfo in self.servers:
rest = RestConnection(serverInfo)
proxyPort = rest.get_nodes_self().moxi + 1000
rest.create_bucket(bucket=name, ramQuotaMB=200, proxyPort=proxyPort)
msg = 'create_bucket succeeded but bucket {0} does not exist'.format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
示例7: test_default_on_non_default_port
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_default_on_non_default_port(self):
name = "default"
for serverInfo in self.servers:
rest = RestConnection(serverInfo)
proxyPort = rest.get_nodes_self().moxi + 1000
rest.create_bucket(
bucket=name, ramQuotaMB=200, proxyPort=proxyPort, authType="sasl", saslPassword="test_non_default"
)
msg = "create_bucket succeeded but bucket {0} does not exist".format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
示例8: test_valid_chars
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_valid_chars(self):
name = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.%"
for serverInfo in self.servers:
rest = RestConnection(serverInfo)
proxyPort = rest.get_nodes_self().moxi
try:
rest.create_bucket(bucket=name, ramQuotaMB=200, authType="sasl", proxyPort=proxyPort)
except BucketCreationException as ex:
self.log.error(ex)
self.fail("could not create bucket with all valid characters")
msg = "failed to start up bucket with all valid characters"
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
示例9: test_one_replica
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_one_replica(self):
postfix = uuid.uuid4()
name = 'replica_{0}'.format(postfix)
for serverInfo in self.servers:
rest = RestConnection(serverInfo)
proxyPort = rest.get_nodes_self().moxi
try:
rest.create_bucket(bucket=name, ramQuotaMB=200, authType='sasl', proxyPort=proxyPort)
except BucketCreationException as ex:
self.log.error(ex)
self.fail('failed to create bucket with 1 replicas')
msg = 'failed to start up bucket with 1 replicas'
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
示例10: _create_bucket
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def _create_bucket(self, number_of_replicas=1, bucket_name='default'):
self.bucket_name = bucket_name
ip_rest = RestConnection(self.servers[0])
info = ip_rest.get_nodes_self()
bucket_ram = info.memoryQuota * 2 / 3
self.log.info('creating bucket : {0}'.format(self.bucket_name))
ip_rest.create_bucket(bucket=self.bucket_name,
ramQuotaMB=bucket_ram,
replicaNumber=number_of_replicas,
proxyPort=11220)
msg = 'create_bucket succeeded but bucket {0} does not exist'.format(self.bucket_name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(self.bucket_name,
ip_rest), msg=msg)
BucketOperationHelper.wait_for_memcached(self.servers[0], self.bucket_name)
示例11: test_max_memory_quota
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_max_memory_quota(self):
postfix = uuid.uuid4()
name = "maxquota_{0}".format(postfix)
for serverInfo in self.servers:
rest = RestConnection(serverInfo)
info = rest.get_nodes_self()
proxyPort = rest.get_nodes_self().moxi
bucket_ram = info.memoryQuota
try:
rest.create_bucket(bucket=name, ramQuotaMB=bucket_ram, authType="sasl", proxyPort=proxyPort)
except BucketCreationException as ex:
self.log.error(ex)
self.fail("failed to create bucket with max ram per node")
msg = "failed to start up bucket with max ram per node"
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
示例12: test_default_case_sensitive_different_ports
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_default_case_sensitive_different_ports(self):
name = "default"
for serverInfo in self.servers:
rest = RestConnection(serverInfo)
proxyPort = rest.get_nodes_self().moxi + 500
rest.create_bucket(bucket=name, ramQuotaMB=200, proxyPort=proxyPort)
msg = "create_bucket succeeded but bucket {0} does not exist".format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
try:
name = "DEFAULT"
rest.create_bucket(bucket=name, ramQuotaMB=200, proxyPort=proxyPort + 1000)
msg = "create_bucket created two buckets in different case : {0},{1}".format("default", "DEFAULT")
self.fail(msg)
except BucketCreationException as ex:
# check if 'default' and 'Default' buckets exist
self.log.info("BucketCreationException was thrown as expected")
self.log.info(ex.message)
示例13: test_non_default_case_sensitive_same_port
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_non_default_case_sensitive_same_port(self):
postfix = uuid.uuid4()
name = "uppercase_{0}".format(postfix)
for serverInfo in self.servers:
rest = RestConnection(serverInfo)
proxyPort = rest.get_nodes_self().moxi + 100
rest.create_bucket(bucket=name, ramQuotaMB=200, proxyPort=proxyPort)
msg = "create_bucket succeeded but bucket {0} does not exist".format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
self.log.info("user should not be able to create a new bucket on a an already used port")
name = "UPPERCASE{0}".format(postfix)
try:
rest.create_bucket(bucket=name, ramQuotaMB=200, proxyPort=proxyPort)
self.fail("create-bucket did not throw exception while creating a new bucket on an already used port")
# make sure it raises bucketcreateexception
except BucketCreationException as ex:
self.log.error(ex)
示例14: test_ephemeral_buckets
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_ephemeral_buckets(self):
eviction_policy = self.input.param("eviction_policy", 'noEviction')
shared_params = self._create_bucket_params(server=self.server, size=100,
replicas=self.num_replicas, bucket_type='ephemeral',
eviction_policy=eviction_policy)
# just do sasl for now, pending decision on support of non-sasl buckets in 5.0
self.cluster.create_sasl_bucket(name=self.bucket_name, password=self.sasl_password, bucket_params=shared_params)
self.buckets.append(Bucket(name=self.bucket_name, authType="sasl", saslPassword=self.sasl_password,
num_replicas=self.num_replicas,
bucket_size=self.bucket_size, master_id=self.server))
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)
self._load_all_buckets(self.server, gen_load, "create", 0)
self.cluster.bucket_delete(self.server, self.bucket_name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_deletion(self.bucket_name, self.rest, timeout_in_seconds=60),
msg='bucket "{0}" was not deleted even after waiting for 30 seconds'.format(self.bucket_name))
示例15: test_default_moxi_sasl
# 需要导入模块: from membase.helper.bucket_helper import BucketOperationHelper [as 别名]
# 或者: from membase.helper.bucket_helper.BucketOperationHelper import wait_for_bucket_creation [as 别名]
def test_default_moxi_sasl(self):
name = 'new-bucket-{0}'.format(uuid.uuid4())
for serverInfo in self.servers:
rest = RestConnection(serverInfo)
replicaNumber = 1
proxyPort = rest.get_nodes_self().moxi
rest.create_bucket(bucket=name,
ramQuotaMB=200,
replicaNumber=replicaNumber,
proxyPort=proxyPort,
authType="sasl",
saslPassword='password')
msg = 'create_bucket succeeded but bucket {0} does not exist'.format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_creation(name, rest), msg=msg)
ready = BucketOperationHelper.wait_for_memcached(serverInfo, name)
self.assertTrue(ready, "wait_for_memcached failed")
rest.delete_bucket(name)
msg = 'bucket "{0}" was not deleted even after waiting for two minutes'.format(name)
self.assertTrue(BucketOperationHelper.wait_for_bucket_deletion(name, rest, timeout_in_seconds=30), msg=msg)