def setUp(self): self.today = FAKE_TODAY self.engine_type = factory_physical.EngineTypeFactory(name='mysql') self.engine = factory_physical.EngineFactory( engine_type=self.engine_type) self.plan = factory_physical.PlanFactory(engine=self.engine) self.databaseinfra = factory_physical.DatabaseInfraFactory( name="__test__ mysqlinfra2", user="******", password='******', engine=self.engine, plan=self.plan, ssl_configured=True) self.hostname = factory_physical.HostFactory(ssl_expire_at=FAKE_TODAY + timedelta(days=16)) self.instances = self.instance_helper.create_instances_by_quant( instance_type=Instance.MYSQL, qt=1, infra=self.databaseinfra, hostname=self.hostname) self.instance = self.instances[0] self.database = factory_logical.DatabaseFactory( name='test_db_1', databaseinfra=self.databaseinfra, ) self.one_month_later = self.today + timedelta(days=30)
def _create_database_structure(cls): mysql_host = settings.DB_HOST mysql_port = settings.DB_PORT or 3306 cls.mysql_endpoint = '{}:{}'.format(mysql_host, mysql_port) cls.engine_type = factory_physical.EngineTypeFactory(name='mysql') cls.engine = factory_physical.EngineFactory( engine_type=cls.engine_type) cls.disk_offering = factory_physical.DiskOfferingFactory( size_kb=524288) cls.plan = factory_physical.PlanFactory( disk_offering=cls.disk_offering, engine=cls.engine) cls.databaseinfra = factory_physical.DatabaseInfraFactory( name="__test__ mysqlinfra2", user="******", password=settings.DB_PASSWORD, endpoint=cls.mysql_endpoint, engine=cls.engine, disk_offering=cls.disk_offering, plan=cls.plan) cls.hostname = factory_physical.HostFactory() cls.instance = factory_physical.InstanceFactory( address="new_instance.localinstance", port=123, is_active=True, instance_type=Instance.MYSQL, databaseinfra=cls.databaseinfra, hostname=cls.hostname) cls.database = factory_logical.DatabaseFactory( name='test_db_1', databaseinfra=cls.databaseinfra, ) cls.nfsaas_host_attr = factory_physical.NFSaaSHostAttr( host=cls.hostname, # nfsaas_size_kb=cls.database.total_size_in_kb, nfsaas_used_size_kb=cls.database.used_size_in_kb)
def _create_database_structure(cls): mysql_host = settings.DB_HOST mysql_port = settings.DB_PORT or 3306 cls.mysql_endpoint = '{}:{}'.format(mysql_host, mysql_port) cls.engine_type = factory_physical.EngineTypeFactory(name=cls.ENGINE) cls.engine = factory_physical.EngineFactory( engine_type=cls.engine_type) cls.disk_offering = factory_physical.DiskOfferingFactory( size_kb=524288) cls.plan = factory_physical.PlanFactory( disk_offering=cls.disk_offering, engine=cls.engine) cls.databaseinfra = factory_physical.DatabaseInfraFactory( name="__test__ mysqlinfra2", user="******", password=settings.DB_PASSWORD, endpoint=cls.mysql_endpoint, engine=cls.engine, disk_offering=cls.disk_offering, plan=cls.plan) cls.hostname = factory_physical.HostFactory() cls.instances = cls.instance_helper.create_instances_by_quant( instance_type=Instance.MYSQL, qt=cls.instances_quantity, infra=cls.databaseinfra, hostname=cls.hostname) cls.instance = cls.instances[0] cls.database = factory_logical.DatabaseFactory( name='test_db_1', databaseinfra=cls.databaseinfra, ) cls.volume = factory_physical.VolumeFactory( host=cls.hostname, used_size_kb=cls.database.used_size_in_kb)
def setUp(self): self.today = FAKE_TODAY self.engine_type = factory_physical.EngineTypeFactory(name='mysql') self.engine = factory_physical.EngineFactory( engine_type=self.engine_type) self.plan = factory_physical.PlanFactory(engine=self.engine) self.environment, self.databaseinfra, self.hostname, self.database = ( self._create_database()) self.one_month_later = self.today + timedelta(days=30)
def test_cannot_upgrade_mongo24(self): mongo = physical_factory.EngineTypeFactory() mongo.name = 'mongodb' mongo24 = physical_factory.EngineFactory() mongo24.engine_type = mongo mongo24.version = '2.4.xxx' database = factory.DatabaseFactory() database.status = database.ALIVE infra = database.databaseinfra infra.engine = mongo24 database.databaseinfra = infra can_do_upgrade, error = database.can_do_upgrade() self.assertFalse(can_do_upgrade) self.assertEqual(error, ERROR_UPGRADE_MONGO24)