def count_s3_records()

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


def count_s3_records(bucket_name):
    LOGGER.info("Counting data records in bucket: %s", bucket_name)
    bucket = s3_client.Bucket(bucket_name)
    record_count = 0
    for obj in bucket.objects.all():
        file_contents = obj.get()["Body"].read()
        record_count = record_count + file_contents.decode('utf-8').count('\n')
        verify_file_contents(file_contents)
    LOGGER.info("Obtained record_count: {} from bucket: {}".format(record_count, bucket_name))
    return record_count