Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Benchmark for record schema validation #2053

13 changes: 13 additions & 0 deletions tests/core/sinks/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,16 @@ def run_validate_and_parse():
_ = sink._validate_and_parse(record.copy())

benchmark(run_validate_and_parse)


def test_bench_validate_record_with_schema(benchmark, bench_sink, bench_record):
"""Run benchmark for Sink._validator method validate."""
number_of_runs = 1000

sink: BatchSinkMock = bench_sink

def run_validate_record_with_schema():
for record in itertools.repeat(bench_record, number_of_runs):
sink._validator.validate(record)

benchmark(run_validate_record_with_schema)