def get_test_status()

in lib/integration-test/lambda/get_test_status.py [0:0]


def get_test_status(event, context):
    LOGGER.info("Received event: %s", event)
    if 'wait_loop_count' in event:
        event['wait_loop_count'] = event['wait_loop_count'] + 1
    else:
        event['wait_loop_count'] = 0
    try:
        row_count = count_s3_records(event['FirehoseOutputBucket'])
        if(row_count == event['record_count']):
            event['status'] = "SUCCEEDED"
            return event
        elif event['wait_loop_count'] < 2:
            event['status'] = "PROCESSING"
            return event
        else:
            event['status'] = "FAILED"
            return event
    except Exception as e:
        LOGGER.exception("Error while validating output data records from S3.")
        return {'status': 'FAILED', 'guid':event, 'error_message': str(e) }