Ejemplo n.º 1
0
def test_param_parsing():
    template_params = read_params_file(
        'qas', 'avo', 'delta',
        path='syncrator-openshift/job_params'
    )

    assert template_params == {
        'ACTION': 'delta',
        'ACTION_NAME': 'delta',
        'ENV': 'qas',
        'IS_TAG': 'latest',
        'OPTIONS': '-n 1000 -c 1',
        'TARGET': 'avo'
    }

    # test these params in oc_create command

    result = oc_create_job(template_params)
    assert result == ' '.join((
        'oc process -f syncrator-openshift/job_template.yaml',
        '-p ENV="qas" -p TARGET="avo"',
        '-p ACTION_NAME="delta" -p ACTION="delta"',
        '-p IS_TAG="latest"',
        '-p OPTIONS="-n 1000 -c 1" | oc create -f -'
    ))
Ejemplo n.º 2
0
def start_delta_job(project):
    environment = app.config.get('SYNC_ENV')
    try:
        return run(read_params_file(environment, project, 'delta'),
                   dryrun=request.method == 'GET')
    except FileNotFoundError as fe:
        return 'Configuration file for ' \
            'project {} with environment {} not found at {}'.format(
                project, environment, fe), 400