def set_up(self): """Create client for mgmt instance test (2).""" if not CONFIG.fake_mode: raise SkipTest("This test only works in fake mode.") self.client = create_client(is_admin=True) self.mgmt = self.client.management # Fake nova will fail a server ending with 'test_SERVER_ERROR'." # Fake volume will fail if the size is 13. # TODO(tim.simpson): This would be a lot nicer looking if we used a # traditional mock framework. datastore = {'type': 'mysql', 'version': '5.5'} body = {'datastore': datastore} vol_support = CONFIG.get(datastore['type'], 'mysql')['volume_support'] if vol_support: body.update({'size': 13}) shared_network = CONFIG.get('shared_network', None) if shared_network: nics = [{'net-id': shared_network}] response = self.client.instances.create( 'test_SERVER_ERROR', instance_info.dbaas_flavor_href, body, [], [], nics=nics ) poll_until(lambda: self.client.instances.get(response.id), lambda instance: instance.status == 'ERROR', time_out=10) self.id = response.id
def set_up(self): self.client = create_client(is_admin=False) self.mgmt_client = create_client(is_admin=True) if EPHEMERAL_SUPPORT: flavor_name = test_config.values.get('instance_eph_flavor_name', 'eph.rd-tiny') flavor2_name = test_config.values.get( 'instance_bigger_eph_flavor_name', 'eph.rd-smaller') else: flavor_name = test_config.values.get('instance_flavor_name', 'm1.tiny') flavor2_name = test_config.values.get( 'instance_bigger_flavor_name', 'm1.small') flavors = self.client.find_flavors_by_name(flavor_name) self.flavor_id = flavors[0].id self.name = "TEST_" + str(datetime.now()) # Get the resize to flavor. flavors2 = self.client.find_flavors_by_name(flavor2_name) self.new_flavor_id = flavors2[0].id assert_not_equal(self.flavor_id, self.new_flavor_id)
def set_up(self): self.client = create_client(is_admin=False) self.mgmt_client = create_client(is_admin=True) if EPHEMERAL_SUPPORT: flavor_name = test_config.values.get('instance_eph_flavor_name', 'eph.rd-tiny') flavor2_name = test_config.values.get( 'instance_bigger_eph_flavor_name', 'eph.rd-smaller') else: flavor_name = test_config.values.get('instance_flavor_name', 'm1.tiny') flavor2_name = test_config.values.get( 'instance_bigger_flavor_name', 'm1.small') flavors = self.client.find_flavors_by_name(flavor_name) self.flavor_id = flavors[0].id self.name = "TEST_" + str(uuid.uuid4()) # Get the resize to flavor. flavors2 = self.client.find_flavors_by_name(flavor2_name) self.new_flavor_id = flavors2[0].id asserts.assert_not_equal(self.flavor_id, self.new_flavor_id)
def setUp(self): self.user1 = CONFIG.users.find_user(Requirements(is_admin=False)) self.user2 = CONFIG.users.find_user(Requirements(is_admin=False)) assert_not_equal(self.user1.tenant, self.user2.tenant, "Not enough users to run QuotasTest. Needs >=2.") self.client1 = create_dbaas_client(self.user1) self.client2 = create_dbaas_client(self.user2) self.mgmt_client = create_client(is_admin=True) ''' Orig quotas from config "trove_max_instances_per_user": 55, "trove_max_volumes_per_user": 100, ''' self.original_quotas1 = self.mgmt_client.quota.show(self.user1.tenant) self.original_quotas2 = self.mgmt_client.quota.show(self.user2.tenant)
def set_up(self): """Create client for mgmt instance test (2).""" if not CONFIG.fake_mode: raise SkipTest("This test only works in fake mode.") self.client = create_client(is_admin=True) self.mgmt = self.client.management # Fake nova will fail a server ending with 'test_SERVER_ERROR'." # Fake volume will fail if the size is 13. # TODO(tim.simpson): This would be a lot nicer looking if we used a # traditional mock framework. body = None if CONFIG.trove_volume_support: body = {'size': 13} response = self.client.instances.create( 'test_SERVER_ERROR', instance_info.dbaas_flavor_href, body, []) poll_until(lambda: self.client.instances.get(response.id), lambda instance: instance.status == 'ERROR', time_out=10) self.id = response.id
def set_up(self): client = create_client(is_admin=False) name = 'test_createInstance_container' flavor = 1 volume_size = 1 db_name = 'test_db' databases = [ { "name": db_name } ] users = [ { "name": "lite", "password": "******", "databases": [{"name": db_name}] } ] #create the Instance instance = InstanceGenerator(client, name=self.name, flavor=flavor, volume_size=self.volume_size, databases=databases, users=users) instance.create_instance() #wait for the instance instance.wait_for_build_to_finish() #get the active instance inst = instance.get_active_instance() #list out the databases for our instance and verify the db name dbs = client.databases.list(inst.id) client.assert_http_code(200) assert_equal(len(dbs), 1) assert_equal(dbs[0].name, instance.db_name) client.instance.delete(inst.id) client.assert_http_code(202)
def set_up(self): client = create_client(is_admin=False) name = 'test_createInstance_container' flavor = 1 volume_size = 1 db_name = 'test_db' databases = [{"name": db_name}] users = [{ "name": "lite", "password": "******", "databases": [{ "name": db_name }] }] #create the Instance instance = InstanceGenerator(client, name=self.name, flavor=flavor, volume_size=self.volume_size, databases=databases, users=users) instance.create_instance() #wait for the instance instance.wait_for_build_to_finish() #get the active instance inst = instance.get_active_instance() #list out the databases for our instance and verify the db name dbs = client.databases.list(inst.id) client.assert_http_code(200) assert_equal(len(dbs), 1) assert_equal(dbs[0].name, instance.db_name) client.instance.delete(inst.id) client.assert_http_code(202)
def mgmt_index_requires_admin_account(): """Verify that an admin context is required to call this function. """ client = create_client(is_admin=False) assert_raises(exceptions.Unauthorized, client.management.index)
def mgmt_index_requires_admin_account(): """Verify that an admin context is required to call this function.""" client = create_client(is_admin=False) assert_raises(exceptions.Unauthorized, client.management.index)
def mgmt_datastore_version_list_requires_admin_account(self): """Test admin is required to list datastore versions.""" client = create_client(is_admin=False) assert_raises(exceptions.Unauthorized, client.mgmt_datastore_versions.list)
def setup(self): self.client = create_client(is_admin=False)
def mgmt_datastore_version_list_requires_admin_account(): """Verify that an admin context is required to call this function.""" client = create_client(is_admin=False) assert_raises(exceptions.Unauthorized, client.mgmt_datastore_versions.list)