def step_impl(context): unit_type = utils.get_normalized_unit_type("ingest") uuid_val = utils.get_uuid_val(context, unit_type) job = context.am_user.browser.parse_job("Index AIP", uuid_val, unit_type=unit_type) for task_data in job["tasks"].values(): assert ("Skipping indexing: indexing is currently disabled." in task_data["stderr"])
def step_impl(context): unit_type = utils.get_normalized_unit_type('ingest') uuid_val = utils.get_uuid_val(context, unit_type) job = context.am_user.browser.parse_job('Index AIP', uuid_val, unit_type=unit_type) for task_data in job['tasks'].values(): assert ('Skipping indexing: indexing is currently disabled.' in task_data['stderr'])
def step_impl(context): uuid_val = utils.get_uuid_val(context, 'sip') # For some reason, it is necessary to pause a moment before downloading the # AIP pointer file because otherwise, e.g., after a re-ingest, it can be # out of date. See @reencrypt-different-key. time.sleep(context.am_user.pessimistic_wait) context.scenario.aip_pointer_path = app = ( context.am_user.api.download_aip_pointer_file( uuid_val, context.am_user.browser.ss_api_key)) logger.info('downloaded AIP pointer file for AIP %s to %s', uuid_val, app)
def step_impl(context, aip_description): aip_description = aip_description.strip() if aip_description: aip_description = aip_description + '_aip' aip_attr = utils.aip_descr_to_attr(aip_description) uuid_val = getattr(context.scenario, aip_attr) else: uuid_val = utils.get_uuid_val(context, 'sip') transfer_name = context.scenario.transfer_name context.scenario.aip_path = context.am_user.api.download_aip( transfer_name, uuid_val, context.am_user.browser.ss_api_key) attr_name = aip_description.replace(' ', '') logger.info('setting attribute %s to %s', attr_name, context.scenario.aip_path) setattr(context.scenario, attr_name, context.scenario.aip_path)
def _download_the_aip(context, aip_description): aip_description = aip_description.strip() if aip_description: aip_description = aip_description + "_aip" aip_attr = utils.aip_descr_to_attr(aip_description) uuid_val = getattr(context.scenario, aip_attr) else: uuid_val = utils.get_uuid_val(context, "sip") transfer_name = context.scenario.transfer_name context.scenario.aip_path = context.am_user.api.download_aip( transfer_name, uuid_val, context.am_user.browser.ss_api_key) attr_name = aip_description.replace(" ", "") logger.info("setting attribute %s to %s", attr_name, context.scenario.aip_path) setattr(context.scenario, attr_name, context.scenario.aip_path)
def step_impl(context): """Assert that ``context.scenario.aip_search_results`` is a list of exactly two dicts, one of which represents "the master AIP" (whose UUID is in ``context.scenariosip_uuid``) and the other representing the replica AIP. Store both AIP representations in ``context.scenario``. """ the_aip_uuid = utils.get_uuid_val(context, "sip") search_results = context.scenario.aip_search_results assert ( len(search_results) == 2 ), "We expected 2 search results but there are {} in {}".format( len(search_results), str(search_results) ) the_aips = [dct for dct in search_results if dct["uuid"] == the_aip_uuid] not_the_aips = [dct for dct in search_results if dct["uuid"] != the_aip_uuid] assert len(the_aips) == 1 assert len(not_the_aips) == 1 the_aip = the_aips[0] replica = not_the_aips[0] replica_uuid = replica["uuid"] assert replica["replica_of"] == the_aip["uuid"] expected_replica_actions = set(["Pointer File", "Download", "Request Deletion"]) replica_actions = set([x.strip() for x in replica["actions"].split("|")]) assert ( replica_actions == expected_replica_actions ), "We expected the replica actions to be {} but in fact they were {}".format( expected_replica_actions, replica_actions ) expected_aip_actions = set( ["Pointer File", "Download", "Request Deletion", "Re-ingest"] ) aip_actions = set([x.strip() for x in the_aip["actions"].split("|")]) assert ( aip_actions == expected_aip_actions ), "We expected the AIP actions to be {} but in fact they were {}".format( expected_aip_actions, aip_actions ) context.scenario.master_aip_uuid = the_aip_uuid context.scenario.replica_aip_uuid = replica_uuid
def step_impl(context): """Assert that ``context.scenario.aip_search_results`` is a list of exactly two dicts, one of which represents "the master AIP" (whose UUID is in ``context.scenariosip_uuid``) and the other representing the replica AIP. Store both AIP representations in ``context.scenario``. """ the_aip_uuid = utils.get_uuid_val(context, 'sip') search_results = context.scenario.aip_search_results assert len(search_results) == 2, ( 'We expected 2 search results but there are {} in {}'.format( len(search_results), str(search_results))) the_aips = [dct for dct in search_results if dct['uuid'] == the_aip_uuid] not_the_aips = [ dct for dct in search_results if dct['uuid'] != the_aip_uuid ] assert len(the_aips) == 1 assert len(not_the_aips) == 1 the_aip = the_aips[0] replica = not_the_aips[0] replica_uuid = replica['uuid'] assert the_aip['replicas'] == replica['uuid'], ( 'We expected {} and {} to be the same, but they are not the same.'. format(the_aip['replicas'], replica['uuid'])) assert replica['is_replica_of'] == the_aip['uuid'] expected_replica_actions = set(['Download', 'Request', 'Deletion']) replica_actions = set([x.strip() for x in replica['actions'].split()]) assert replica_actions == expected_replica_actions, ( 'We expected the replica actions to be {} but in fact they were {}'. format(expected_replica_actions, replica_actions)) expected_aip_actions = set( ['Download', 'Request', 'Deletion', 'Re-ingest']) aip_actions = set([x.strip() for x in the_aip['actions'].split()]) assert aip_actions == expected_aip_actions, ( 'We expected the AIP actions to be {} but in fact they were {}'.format( expected_aip_actions, aip_actions)) context.scenario.master_aip_uuid = the_aip_uuid context.scenario.replica_aip_uuid = replica_uuid
def step_impl(context, microservice_name, microservice_output, unit_type): unit_type = utils.get_normalized_unit_type(unit_type) uuid_val = utils.get_uuid_val(context, unit_type) context.scenario.job = context.am_user.browser.parse_job( microservice_name, uuid_val, unit_type=unit_type) assert context.scenario.job.get('job_output') == microservice_output
def step_impl(context): uuid_val = utils.get_uuid_val(context, 'sip') context.am_user.browser.request_aip_delete(uuid_val) context.am_user.browser.approve_aip_delete_request(uuid_val)
def step_impl(context, reingest_type): uuid_val = utils.get_uuid_val(context, 'sip') context.am_user.browser.initiate_reingest(uuid_val, reingest_type=reingest_type)
def step_impl(context): context.am_user.browser.add_dummy_metadata( utils.get_uuid_val(context, 'sip'))
def step_impl(context): uuid_val = utils.get_uuid_val(context, 'transfer') context.am_user.browser.wait_for_dip_in_transfer_backlog(uuid_val)
def step_impl(context): time.sleep(context.am_user.optimistic_wait) the_aip_uuid = utils.get_uuid_val(context, 'sip') context.scenario.aip_search_results = ( context.am_user.browser.search_for_aip_in_storage_service(the_aip_uuid) )
def step_impl(context): uuid_val = utils.get_uuid_val(context, 'sip') context.am_user.browser.wait_for_aip_in_archival_storage(uuid_val) time.sleep(context.am_user.medium_wait)
def _perform_reingest(context, reingest_type): uuid_val = utils.get_uuid_val(context, "sip") context.am_user.browser.initiate_reingest(uuid_val, reingest_type=reingest_type)
def _appear_in_storage(context): """Helper to wrap the functionality to test for an AIP in archival storage. """ uuid_val = utils.get_uuid_val(context, "sip") context.am_user.browser.wait_for_aip_in_archival_storage(uuid_val) time.sleep(context.am_user.pessimistic_wait)