Example #1
0
def agave_app_id():
    """Generates a random (but schema-compliant) Agave Apps identifier
    """
    app_name = random_string(int(random.random() * 18) + 6).lower()
    app_version = (int(random.random() * 10), int(random.random() * 10),
                   int(random.random() * 10))
    return '{0}-{1}.{2}.{3}'.format(app_name, *app_version)
def test_slot_oneshot_create_write(agave):
    """Confirm that slot can be created and written from one client
    """
    value = random_string(64)
    p = slots.client.Slot(agave=agave)
    p.create().write(value)
    assert p.name is not None
    assert p.ready() is True
    assert p.read() == value
def test_slot_defer_create_write(agave):
    """Confirm that slot can be written from another client
    """
    value = random_string(64)
    p = slots.client.Slot(agave=agave)
    q = slots.client.Slot(agave=agave)
    slot_name = p.create().name
    # Write using another client
    q.write(value, slot_name)
    assert p.ready() is True
    assert p.read() == value
def test_slot_defer_x2_create_write(agave):
    """Confirm that slot can be written from another client and
    read from yet another client.
    """
    value = random_string(64)

    p = slots.client.Slot(agave=agave)
    q = slots.client.Slot(agave=agave)
    r = slots.client.Slot(agave=agave)
    slot_name = p.create().name
    q.write(value, slot_name)
    assert r.ready(slot_name) is True
    assert r.read(slot_name) == value
Example #5
0
def test_none_product_patterns(mongodb_settings, agave, pipelinejobs_config,
                               pipeline_uuid, random_dir_name, admin_token):
    """Confirm that product_patterns can be set to None without failure
    """
    archive_path = '/sample/tacc-cloud/' + random_string(32)
    mpj = ManagedPipelineJob(mongodb_settings,
                             pipelinejobs_config,
                             agave=agave,
                             archive_path=archive_path,
                             experiment_id='experiment.tacc.10001',
                             product_patterns=None,
                             archive_patterns=[]).setup()
    mpj.cancel(token=admin_token)
Example #6
0
def test_uuid_bypass_invalid_metadata(mongodb_settings, agave,
                                      pipelinejobs_config, pipeline_uuid,
                                      random_dir_name, admin_token):
    """Confirm that passing a UUID directly to ManagedPipelineJob metadata
    binding stage bypasses identifier resolution"""
    archive_path = '/sample/tacc-cloud/' + random_string(32)
    ident = typeduuid.catalog_uuid('ThisCanNeverEverEverWork', 'experiment')
    mpj = ManagedPipelineJob(mongodb_settings,
                             pipelinejobs_config,
                             agave=agave,
                             archive_path=archive_path,
                             experiment_id=ident,
                             product_patterns=[],
                             archive_patterns=[]).setup()
def test_slot_delete_after_read(agave):
    """Confirm that slot can be written from another client and
    read from yet another client.
    """
    value = random_string(64)
    p = slots.client.Slot(agave=agave)
    p.create().write(value)
    p_name = p.name
    # p_uuid = p.uuid
    assert p_name is not None
    assert p.ready() is True
    assert p.read(delete=True) == value
    q = slots.client.Slot(agave=agave)
    with pytest.raises(ValueError):
        q.read(key_name=p_name)
Example #8
0
def test_invalid_metadata_child_of(mongodb_settings, agave,
                                   pipelinejobs_config, pipeline_uuid,
                                   random_dir_name, admin_token):
    """Confirm that passing an unknown identifier not in the database will
    cause ManagedPipelineJob initialization to raise an Exception
    """
    archive_path = '/sample/tacc-cloud/' + random_string(32)
    with pytest.raises(ValueError):
        mpj = ManagedPipelineJob(mongodb_settings,
                                 pipelinejobs_config,
                                 agave=agave,
                                 archive_path=archive_path,
                                 experiment_id='ThisCanNeverEverEverWork',
                                 product_patterns=[],
                                 archive_patterns=[]).setup()
Example #9
0
def generated_admin_secret():
    """Generates a plaintext random token secret
    """
    return random_string()
Example #10
0
def generated_admin_key():
    """Generates a plaintext random token key
    """
    return random_string()
Example #11
0
def random_dir_name():
    return random_string(32)