chore: adjust cache benchmark to better reflect real cache data (#1491) · python-zeroconf/python-zeroconf@854fef6

Original file line numberDiff line numberDiff line change

@@ -15,15 +15,15 @@ def test_add_expire_1000_records(benchmark: BenchmarkFixture) -> None:

1515

class_=_CLASS_IN,

1616

ttl=60,

1717

alias=f"test{id}.local.",

18-

created=now,

18+

created=now + id,

1919

)

2020

for id in range(1000)

2121

]

2222
2323

@benchmark

2424

def _expire_records() -> None:

2525

cache.async_add_records(records)

26-

cache.async_expire(now + 61_000)

26+

cache.async_expire(now + 100_000)

2727
2828
2929

def test_expire_no_records_to_expire(benchmark: BenchmarkFixture) -> None:

@@ -37,7 +37,7 @@ def test_expire_no_records_to_expire(benchmark: BenchmarkFixture) -> None:

3737

class_=_CLASS_IN,

3838

ttl=60,

3939

alias=f"test{id}.local.",

40-

created=now,

40+

created=now + id,

4141

)

4242

for id in range(1000)

4343

)