def test_resolve_args():

    pipeline = str(ru.generate_id('pipeline'))
    stage = str(ru.generate_id('stage'))
    t1 = str(ru.generate_id('task'))
    t2 = str(ru.generate_id('task'))

    placeholder_dict = {
        pipeline: {
            stage: {
                t1: {
                    'path': '/home/vivek/t1',
                    'rts_uid': 'unit.0002'
                },
                t2: {
                    'path': '/home/vivek/t2',
                    'rts_uid': 'unit.0003'
                }
            }
        }
    }

    arguments = [
        '$SHARED',
        '$Pipeline_%s_Stage_%s_Task_%s' % (pipeline, stage, t1),
        '$Pipeline_%s_Stage_%s_Task_%s' % (pipeline, stage, t2)
    ]

    assert resolve_arguments(arguments, placeholder_dict) == [
        '$RP_PILOT_STAGING', '/home/vivek/t1', '/home/vivek/t2'
    ]
Esempio n. 2
0
def test_resolve_args():

    pipeline_name = 'p1'
    stage_name = 's1'
    t1_name = 't1'
    t2_name = 't2'

    placeholders = {
        pipeline_name: {
            stage_name: {
                t1_name: {
                    'path': '/home/vivek/t1',
                    'rts_uid': 'unit.0002'
                },
                t2_name: {
                    'path': '/home/vivek/t2',
                    'rts_uid': 'unit.0003'
                }
            }
        }
    }

    arguments = [
        '$SHARED',
        '$Pipeline_%s_Stage_%s_Task_%s' % (pipeline_name, stage_name, t1_name),
        '$Pipeline_%s_Stage_%s_Task_%s' % (pipeline_name, stage_name, t2_name),
        '$NODE_LFS_PATH/test.txt'
    ]

    resolved = resolve_arguments(arguments, placeholders)
    assert resolved == [
        '$RP_PILOT_STAGING', '/home/vivek/t1', '/home/vivek/t2',
        '$NODE_LFS_PATH/test.txt'
    ]
def test_resolve_args():

    pipeline_name = 'p1'
    stage_name = 's1'
    t1_name = 't1'
    t2_name = 't2'

    placeholder_dict = {
        pipeline_name: {
            stage_name: {
                t1_name: {
                    'path': '/home/vivek/t1',
                    'rts_uid': 'unit.0002'
                },
                t2_name: {
                    'path': '/home/vivek/t2',
                    'rts_uid': 'unit.0003'
                }
            }
        }
    }

    arguments = ['$SHARED',
                 '$Pipeline_%s_Stage_%s_Task_%s' % (pipeline_name, stage_name, t1_name),
                 '$Pipeline_%s_Stage_%s_Task_%s' % (pipeline_name, stage_name, t2_name),
                 '$NODE_LFS_PATH/test.txt']

    assert resolve_arguments(arguments, placeholder_dict) == ['$RP_PILOT_STAGING',
                                                              '/home/vivek/t1',
                                                              '/home/vivek/t2',
                                                              '$NODE_LFS_PATH/test.txt']