本文整理汇总了Python中libraries.testkit.admin.Admin.create_db方法的典型用法代码示例。如果您正苦于以下问题:Python Admin.create_db方法的具体用法?Python Admin.create_db怎么用?Python Admin.create_db使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libraries.testkit.admin.Admin
的用法示例。
在下文中一共展示了Admin.create_db方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from libraries.testkit.admin import Admin [as 别名]
# 或者: from libraries.testkit.admin.Admin import create_db [as 别名]
class SyncGateway:
def __init__(self, cluster_config, target):
self.ansible_runner = AnsibleRunner(cluster_config)
self.ip = target["ip"]
self.url = "http://{}:4984".format(target["ip"])
self.hostname = target["name"]
self._headers = {'Content-Type': 'application/json'}
self.admin = Admin(self)
def info(self):
r = requests.get(self.url)
r.raise_for_status()
return r.text
def stop(self):
status = self.ansible_runner.run_ansible_playbook(
"stop-sync-gateway.yml",
subset=self.hostname
)
return status
def start(self, config):
conf_path = os.path.abspath(config)
log.info(">>> Starting sync_gateway with configuration: {}".format(conf_path))
status = self.ansible_runner.run_ansible_playbook(
"start-sync-gateway.yml",
extra_vars={
"sync_gateway_config_filepath": conf_path
},
subset=self.hostname
)
return status
def restart(self, config):
conf_path = os.path.abspath(config)
log.info(">>> Restarting sync_gateway with configuration: {}".format(conf_path))
status = self.ansible_runner.run_ansible_playbook(
"reset-sync-gateway.yml",
extra_vars={
"sync_gateway_config_filepath": conf_path,
},
subset=self.hostname
)
return status
def verify_launched(self):
r = requests.get(self.url)
log.info("GET {} ".format(r.url))
log.info("{}".format(r.text))
r.raise_for_status()
def create_db(self, name):
return self.admin.create_db(name)
def delete_db(self, name):
return self.admin.delete_db(name)
def reset(self):
dbs = self.admin.get_dbs()
for db in dbs:
self.admin.delete_db(db)
def start_push_replication(self,
target,
source_db,
target_db,
continuous=True,
use_remote_source=False,
channels=None,
async=False,
use_admin_url=False):