예제 #1
0
def step_impl(context):
    common.check_response_status(context.response, 200)
    # Put together our own 'table' for the single job
    namespace, name = context.job_id.split('.')
    tmp_table = [dict(
        namespace=namespace,
        name=name,
        failed=False,
    )]
    common.shared_check_job_history_response([context.response.json()],
                                             tmp_table)
예제 #2
0
def step_impl(context):
    resp = common.send_api_request(
        context, 'GET',
        'v1/jobs/%s/runs/%s' % (context.job_id, context.job_run_id))
    common.check_response_status(resp, 200)
    exp = dict(
        completedAt=None,
        createdAt=re.compile(r'20.*'),
        id=re.compile(r'%s-[0-9]+' % context.job_id),
        jobId=context.job_id,
        status='FAILED',
        tasks=[],
    )
    if not common.validate_response_content(resp.json(), exp):
        raise Exception('Did not find expected FAILED response')
예제 #3
0
def step_impl(context):
    resp = common.send_api_request(context, 'GET',
                                   'v1/jobs/%s/runs' % context.job_id)
    common.check_response_status(resp, 200)
    # Look for one matching item in the response
    for item in resp.json():
        exp = dict(
            completedAt=re.compile(r'20.*'),
            createdAt=re.compile(r'20.*'),
            id=re.compile(r'%s-[0-9]+' % context.job_id),
            jobId=context.job_id,
            status='COMPLETED',
            tasks=[
                re.compile(r'%s-[0-9]+-.+' % context.job_id),
            ],
        )
        if common.validate_response_content(item, exp):
            return True
    raise Exception('Job run ID not found in list of job runs')
예제 #4
0
def step_impl(context):
    context.job_id = context.table[0]['job']
    resp = common.send_api_request(context, 'POST',
                                   'v1/jobs/%s/runs' % context.job_id)
    common.check_response_status(resp, 201)
    context.job_run_id = resp.json().get('id', None)
예제 #5
0
def step_impl(context):
    common.check_response_status(context.response, 404)
예제 #6
0
def step_impl(context):
    resp = common.send_api_request(context, 'GET',
                                   'v1/jobs/%s' % context.job_id)
    common.check_response_status(resp, 404)
예제 #7
0
def step_impl(context):
    common.check_response_status(context.response, 200)
    expected_response = common.build_expected_job_response(context.table)[0]
    common.assert_expected_response(context.response.json(), expected_response)
예제 #8
0
def step_impl(context):
    common.check_response_status(context.response, 200)
    common.shared_check_job_history_response(context.response.json(),
                                             context.table)
예제 #9
0
def step_impl(context):
    # Purposeful delay to give all jobs a chance to run before we hit max retry attempts
    time.sleep(2)
    context.response = common.send_api_request(context, 'GET',
                                               'v1/jobs?embed=history')
    common.check_response_status(context.response, 200)
예제 #10
0
def step_impl(context):
    context.job_id = context.table[0]['job']
    context.response = common.send_api_request(
        context, 'GET', 'v1/jobs/%s?embed=history' % context.job_id)
    common.check_response_status(context.response, 200)