本文整理匯總了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):