Example #1
0
def test_core_temporary_dids():
    """ TMP DATA IDENTIFIERS (CORE): """

    if config_get_bool('common', 'multi_vo', raise_exception=False, default=False):
        vo = {'vo': config_get('client', 'vo', raise_exception=False, default='tst')}
    else:
        vo = {}
    scope = InternalScope('mock', **vo)
    root = InternalAccount('root', **vo)
    temporary_dids = []
    rse = 'MOCK'
    rse_id = get_rse_id(rse=rse, **vo)
    for _ in range(10):
        temporary_dids.append({'scope': scope,
                               'name': 'object_%s' % generate_uuid(),
                               'rse_id': rse_id,
                               'bytes': 1,
                               'path': None})

    add_temporary_dids(dids=temporary_dids, account=root)

    compose(scope=scope, name='file_%s' % generate_uuid(), rse_id=rse_id,
            bytes=10, sources=temporary_dids, account=root,
            md5=None, adler32=None, pfn=None, meta={}, rules=[],
            parent_scope=None, parent_name=None)

    dids = list_expired_temporary_dids(rse_id=rse_id, limit=10)

    rowcount = delete_temporary_dids(dids=dids)

    assert rowcount == 10
Example #2
0
def test_core_temporary_dids():
    """ TMP DATA IDENTIFIERS (CORE): """

    temporary_dids = []
    rse = 'MOCK'
    rse_id = get_rse_id(rse=rse)
    for _ in range(10):
        temporary_dids.append({'scope': 'mock',
                               'name': 'object_%s' % generate_uuid(),
                               'rse_id': rse_id,
                               'bytes': 1,
                               'path': None})

    add_temporary_dids(dids=temporary_dids, account='root')

    compose(scope='mock', name='file_%s' % generate_uuid(), rse_id=rse_id,
            bytes=10, sources=temporary_dids, account='root',
            md5=None, adler32=None, pfn=None, meta={}, rules=[],
            parent_scope=None, parent_name=None)

    dids = list_expired_temporary_dids(rse_id=rse_id, limit=10)

    rowcount = delete_temporary_dids(dids=dids)

    assert_equal(rowcount, 10)