本文整理汇总了Python中trove.tests.unittests.util.util.init_db函数的典型用法代码示例。如果您正苦于以下问题:Python init_db函数的具体用法?Python init_db怎么用?Python init_db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了init_db函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
util.init_db()
self.datastore = datastore_models.DBDatastore.create(
id=str(uuid.uuid4()), name="name", default_version_id=str(uuid.uuid4())
)
self.datastore_version = datastore_models.DBDatastoreVersion.create(
id=self.datastore.default_version_id,
name="name",
image_id=str(uuid.uuid4()),
packages=str(uuid.uuid4()),
datastore_id=self.datastore.id,
manager="mysql",
active=1,
)
self.master = DBInstance(
InstanceTasks.NONE,
id=str(uuid.uuid4()),
name="TestMasterInstance",
datastore_version_id=self.datastore_version.id,
)
self.master.set_task_status(InstanceTasks.NONE)
self.master.save()
self.master_status = InstanceServiceStatus(
ServiceStatuses.RUNNING, id=str(uuid.uuid4()), instance_id=self.master.id
)
self.master_status.save()
self.safe_nova_client = models.create_nova_client
models.create_nova_client = nova.fake_create_nova_client
super(TestReplication, self).setUp()
开发者ID:pombredanne,项目名称:RDS,代码行数:33,代码来源:test_instance_models.py
示例2: setUp
def setUp(self):
# Basic setup and mock/fake structures for testing only
super(TestDatastoreBase, self).setUp()
util.init_db()
self.rand_id = str(uuid.uuid4())
self.ds_name = "my-test-datastore" + self.rand_id
self.ds_version = "my-test-version" + self.rand_id
self.capability_name = "root_on_create" + self.rand_id
self.capability_desc = "Enables root on create"
self.capability_enabled = True
self.datastore_version_id = str(uuid.uuid4())
self.flavor_id = 1
datastore_models.update_datastore(self.ds_name, False)
self.datastore = Datastore.load(self.ds_name)
datastore_models.update_datastore_version(self.ds_name, self.ds_version, "mysql", "", "", True)
DatastoreVersionMetadata.add_datastore_version_flavor_association(
self.ds_name, self.ds_version, [self.flavor_id]
)
self.datastore_version = DatastoreVersion.load(self.datastore, self.ds_version)
self.test_id = self.datastore_version.id
self.cap1 = Capability.create(self.capability_name, self.capability_desc, True)
self.cap2 = Capability.create("require_volume" + self.rand_id, "Require external volume", True)
self.cap3 = Capability.create("test_capability" + self.rand_id, "Test capability", False)
开发者ID:magictour,项目名称:trove,代码行数:27,代码来源:base.py
示例3: setUp
def setUp(self):
self.context = trove_testtools.TroveTestContext(self, is_admin=True)
util.init_db()
self.datastore = datastore_models.DBDatastore.create(
id=str(uuid.uuid4()),
name='test' + str(uuid.uuid4()),
default_version_id=str(uuid.uuid4()))
self.datastore_version1 = datastore_models.DBDatastoreVersion.create(
id=self.datastore.default_version_id,
name='name' + str(uuid.uuid4()),
image_id='old_image',
packages=str(uuid.uuid4()),
datastore_id=self.datastore.id,
manager='test',
active=1)
self.datastore_version2 = datastore_models.DBDatastoreVersion.create(
id=str(uuid.uuid4()),
name='name' + str(uuid.uuid4()),
image_id='new_image',
packages=str(uuid.uuid4()),
datastore_id=self.datastore.id,
manager='test',
active=1)
self.safe_nova_client = models.create_nova_client
models.create_nova_client = nova.fake_create_nova_client
super(TestInstanceUpgrade, self).setUp()
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:30,代码来源:test_instance_models.py
示例4: setUp
def setUp(self):
# See LP bug #1255178
bkup_models.DBBackup.save = OLD_DBB_SAVE
super(ConductorMethodTests, self).setUp()
util.init_db()
self.cond_mgr = conductor_manager.Manager()
self.instance_id = utils.generate_uuid()
开发者ID:arisu1000,项目名称:trove,代码行数:7,代码来源:test_methods.py
示例5: setUp
def setUp(self):
super(BaseDbStatusTest, self).setUp()
util.init_db()
self.orig_dbaas_time_sleep = dbaas.time.sleep
self.FAKE_ID = randint(1, 10000)
InstanceServiceStatus.create(instance_id=self.FAKE_ID, status=rd_instance.ServiceStatuses.NEW)
dbaas.CONF.guest_id = self.FAKE_ID
开发者ID:ReVolly,项目名称:trove,代码行数:7,代码来源:test_dbaas.py
示例6: setUp
def setUp(self):
util.init_db()
self.fake_tenantid = 'fake_fore_1231242345'
self.fake_context = fake()
self.fake_context.limit = 1000
self.fake_context.is_admin = False
self.fake_context.marker = None
self.fake_context['tenant'] = self.fake_tenantid
self.fake_environ = {wsgi.CONTEXT_KEY : self.fake_context}
self.fake_request = fake()
self.fake_request.url = "http://fore.com/***"
self.fake_request.environ = self.fake_environ
self.cnf_controller = conf_service.ConfigurationsController()
self.para_controller = conf_service.ParametersController()
self.base_body = {
"configuration": {
"values": {},
"name": "test",
"description":"desc....",
"datastore": {
"type": "test_type",
"version": "test_version"
}
}
}
self.fake_dsname = "test_type"
self.fake_dsversion = "test_version"
ds_models.update_datastore(self.fake_dsname)
ds = ds_models.Datastore.load(self.fake_dsname)
ds_models.update_datastore_version(ds.name, self.fake_dsversion, "mysql", "None","None", '1','1')
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:32,代码来源:test_service.py
示例7: setUp
def setUp(self):
super(OrderingTests, self).setUp()
util.init_db()
now = utils.utcnow()
self.context, self.instance_id = _prep_conf(now)
info = {
'tenant_id': self.context.tenant,
'state': BACKUP_STATE,
'instance_id': self.instance_id,
'size': 2.0,
'deleted': False
}
four = now - datetime.timedelta(days=4)
one = now - datetime.timedelta(days=1)
three = now - datetime.timedelta(days=3)
two = now - datetime.timedelta(days=2)
# Create backups out of order, save/create set the 'updated' field,
# so we need to use the db_api directly.
models.DBBackup().db_api.save(
models.DBBackup(name='four', updated=four,
id=utils.generate_uuid(), **info))
models.DBBackup().db_api.save(
models.DBBackup(name='one', updated=one,
id=utils.generate_uuid(), **info))
models.DBBackup().db_api.save(
models.DBBackup(name='three', updated=three,
id=utils.generate_uuid(), **info))
models.DBBackup().db_api.save(
models.DBBackup(name='two', updated=two,
id=utils.generate_uuid(), **info))
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:30,代码来源:test_backup_models.py
示例8: setUp
def setUp(self):
super(TemplateTest, self).setUp()
util.init_db()
self.env = template.ENV
self.template = self.env.get_template("mysql/config.template")
self.flavor_dict = {"ram": 1024, "name": "small", "id": "55"}
self.server_id = "180b5ed1-3e57-4459-b7a3-2aeee4ac012a"
开发者ID:mmasaki,项目名称:trove,代码行数:7,代码来源:test_template.py
示例9: setUp
def setUp(self):
util.init_db()
self.context = Mock()
self.name = "name"
self.module_type = 'ping'
self.contents = 'my_contents\n'
super(CreateModuleTest, self).setUp()
开发者ID:Tesora,项目名称:tesora-trove,代码行数:8,代码来源:test_module_models.py
示例10: setUpClass
def setUpClass(cls):
util.init_db()
# put some fake datastore versions into the usage_report DSV cache
# so that we don't read all the DSVs from the test database
usage_report.DSVS = list()
for dsv in DS_VERSIONS:
usage_report.DSVS.append(MockDSVersion(dsv[0], dsv[1], dsv[2]))
super(UsageReportTest, cls).setUpClass()
开发者ID:Tesora,项目名称:tesora-trove,代码行数:9,代码来源:test_usage_report.py
示例11: setUp
def setUp(self):
super(PXCClusterTasksTest, self).setUp()
util.init_db()
self.cluster_id = "1232"
self.cluster_name = "Cluster-1234"
self.tenant_id = "6789"
self.db_cluster = DBCluster(ClusterTaskStatus.NONE,
id=self.cluster_id,
created=str(datetime.date),
updated=str(datetime.date),
name=self.cluster_name,
task_id=ClusterTaskStatus.NONE._code,
tenant_id=self.tenant_id,
datastore_version_id="1",
deleted=False)
self.dbinst1 = DBInstance(InstanceTasks.NONE, id="1", name="member1",
compute_instance_id="compute-1",
task_id=InstanceTasks.NONE._code,
task_description=InstanceTasks.NONE._db_text,
volume_id="volume-1",
datastore_version_id="1",
cluster_id=self.cluster_id,
type="member")
self.dbinst2 = DBInstance(InstanceTasks.NONE, id="2", name="member2",
compute_instance_id="compute-2",
task_id=InstanceTasks.NONE._code,
task_description=InstanceTasks.NONE._db_text,
volume_id="volume-2",
datastore_version_id="1",
cluster_id=self.cluster_id,
type="member")
self.dbinst3 = DBInstance(InstanceTasks.NONE, id="3", name="member3",
compute_instance_id="compute-3",
task_id=InstanceTasks.NONE._code,
task_description=InstanceTasks.NONE._db_text,
volume_id="volume-3",
datastore_version_id="1",
cluster_id=self.cluster_id,
type="member")
mock_ds1 = Mock()
mock_ds1.name = 'pxc'
mock_dv1 = Mock()
mock_dv1.name = '7.1'
self.clustertasks = ClusterTasks(Mock(),
self.db_cluster,
datastore=mock_ds1,
datastore_version=mock_dv1)
self.cluster_context = {
'replication_user': {
'name': "name",
'password': "password",
},
'cluster_name': self.cluster_name,
'admin_password': "admin_password"
}
开发者ID:vmazur,项目名称:trove,代码行数:55,代码来源:test_pxc_clusters.py
示例12: setUp
def setUp(self):
super(BackupORMTest, self).setUp()
util.init_db()
self.context, self.instance_id = _prep_conf(utils.utcnow())
self.backup = models.DBBackup.create(tenant_id=self.context.tenant,
name=BACKUP_NAME,
state=BACKUP_STATE,
instance_id=self.instance_id,
deleted=False,
location=BACKUP_LOCATION)
self.deleted = False
开发者ID:krast,项目名称:trove,代码行数:11,代码来源:test_backup_models.py
示例13: setUp
def setUp(self):
super(PaginationTests, self).setUp()
util.init_db()
self.context, self.instance_id = _prep_conf(utils.utcnow())
# Create a bunch of backups
bkup_info = {
"tenant_id": self.context.tenant,
"state": BACKUP_STATE,
"instance_id": self.instance_id,
"size": 2.0,
"deleted": False,
}
for backup in xrange(50):
bkup_info.update({"name": "Backup-%s" % backup})
models.DBBackup.create(**bkup_info)
开发者ID:rumale,项目名称:trove,代码行数:15,代码来源:test_backup_models.py
示例14: setUpClass
def setUpClass(cls):
util.init_db()
cls.version_id = str(uuid.uuid4())
cls.datastore = datastore_models.DBDatastore.create(
id=str(uuid.uuid4()),
name='mysql' + str(uuid.uuid4()),
default_version_id=cls.version_id
)
cls.version = datastore_models.DBDatastoreVersion.create(
id=cls.version_id,
datastore_id=cls.datastore.id,
name='5.5' + str(uuid.uuid4()),
manager='mysql',
image_id=str(uuid.uuid4()),
active=1,
packages="mysql-server-5.5"
)
super(MockMgmtInstanceTest, cls).setUpClass()
开发者ID:cp16net,项目名称:trove,代码行数:18,代码来源:test_models.py
示例15: setUp
def setUp(self):
util.init_db()
ds_models.update_datastore("mysql")
self.datastore = ds_models.Datastore.load("mysql")
ds_models.update_datastore_version(self.datastore.id, "mysql-55", "mysql", "None", "None", True)
self.ds_version = ds_models.DatastoreVersion.load(self.datastore, "mysql-55")
test_time = utils.utcnow()
self.conf_name = "test_name_%s " %test_time
self.conf_desc = "test_desc_%s " %test_time
self.configuration = None
self.defaultConfiguration = None
self.tanant_id = "fake_fore_1231242345"
self.context = TroveContext(tenant = self.tanant_id)
self.default_tanant_id = CONF.default_template_tenant_id
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:18,代码来源:test_models.py
示例16: setUp
def setUp(self):
super(MySqlAppTest, self).setUp()
self.orig_utils_execute_with_timeout = dbaas.utils.execute_with_timeout
self.orig_time_sleep = dbaas.time.sleep
util.init_db()
self.FAKE_ID = randint(1, 10000)
InstanceServiceStatus.create(instance_id=self.FAKE_ID,
status=rd_instance.ServiceStatuses.NEW)
self.appStatus = FakeAppStatus(self.FAKE_ID,
rd_instance.ServiceStatuses.NEW)
self.mySqlApp = MySqlApp(self.appStatus)
mysql_service = {'cmd_start': Mock(),
'cmd_stop': Mock(),
'cmd_enable': Mock(),
'cmd_disable': Mock(),
'bin': Mock()}
dbaas.operating_system.service_discovery = Mock(return_value=
mysql_service)
dbaas.time.sleep = Mock()
开发者ID:adamfokken,项目名称:trove,代码行数:19,代码来源:test_dbaas.py
示例17: setUp
def setUp(self):
super(TestDatastoreVersion, self).setUp()
util.init_db()
models.update_datastore(name='test_ds', default_version=None)
models.update_datastore_version(
'test_ds', 'test_vr1', 'mysql',
'154b350d-4d86-4214-9067-9c54b230c0da', 'pkg-1', '1')
models.update_datastore_version(
'test_ds', 'test_vr2', 'mysql',
'154b350d-4d86-4214-9067-9c54b230c0da', 'pkg-1', '1')
self.ds = models.Datastore.load('test_ds')
self.ds_version2 = models.DatastoreVersion.load(self.ds, 'test_vr2')
self.context = Mock()
self.req = Mock()
self.req.environ = Mock()
self.req.environ.__getitem__ = Mock(return_value=self.context)
self.tenant_id = Mock()
self.version_controller = DatastoreVersionController()
开发者ID:magictour,项目名称:trove,代码行数:19,代码来源:test_datastores.py
示例18: setUp
def setUp(self):
util.init_db()
self.db_info = FakeDBInstance()
self.status = InstanceServiceStatus(
ServiceStatuses.RUNNING)
self.datastore = models.DBDatastore.create(
id=str(uuid.uuid4()),
name='mysql',
default_version_id=self.db_info.datastore_version_id
)
self.version = models.DBDatastoreVersion.create(
id=self.db_info.datastore_version_id,
datastore_id=self.datastore.id,
name='5.5',
manager='mysql',
image_id=str(uuid.uuid4()),
active=1,
packages="mysql-server-5.5"
)
super(BaseInstanceStatusTestCase, self).setUp()
开发者ID:arisu1000,项目名称:trove,代码行数:20,代码来源:test_instance_status.py
示例19: setUp
def setUp(self):
util.init_db()
self.replica_datastore_version = Mock(spec=DBDatastoreVersion)
self.replica_datastore_version.id = "UUID"
self.replica_datastore_version.manager = 'mysql'
self.root_info = DBInstance(
InstanceTasks.NONE,
id="Another_instance",
name="TestInstance",
datastore_version_id=self.replica_datastore_version.id)
self.root_info.save()
self.replica_info = DBInstance(
InstanceTasks.NONE,
id="UUID",
name="TestInstance",
datastore_version_id=self.replica_datastore_version.id,
slave_of_id="Another_instance")
self.replica_info.save()
self.safe_nova = models.create_nova_client
models.create_nova_client = nova.fake_create_nova_client
super(TestReplication, self).setUp()
开发者ID:SlickNik,项目名称:trove,代码行数:22,代码来源:test_instance_models.py
示例20: setUp
def setUp(self):
super(basetest, self).setUp()
if self.is_fake:
util.init_db()
self.context = _prep_conf(utils.utcnow())
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:5,代码来源:basetest.py
注:本文中的trove.tests.unittests.util.util.init_db函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论