-
Notifications
You must be signed in to change notification settings - Fork 448
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
let Mapk 'zipN with nullable' tests use Arb.map2 to generate values #2999
Conversation
* improve the Arb2/3 so it can generate maps with null values * let 'zipX with nullables' test use Arb2 instead of generating the maps in every test * re-enable Arb2/3 tests with fixed RandomSource to prevent random failures
) { keys, a, b -> | ||
val mapA = keys.zip(a).toMap() | ||
val mapB = keys.zip(b).toMap() | ||
Arb.map2(Arb.int(), Arb.int(), Arb.int().orNull()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the change in the width of the integers and lists is making tests to take much longer in Kotlin/Native targets. Could we keep the maps under 10 keys, and intSmall
, as done in the code that this replaces? Or otherwise, find another way to make tests run faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apparently some of the GeneratorTests took a long time. I changed them so they run faster now.
@abendt thanks for the hard work on this! I'm a bit worried still by the fact that Native tests seem to have gone much slower (by comparison, other PRs take around 25 minutes on Mac, and 20 on Windows, and this one takes almost double). |
@serras sure, will have another look and then get back to you |
Hi @serras, here are my results To compare the times i picked this PR (#2993). This should be a PR that comes right before any of my MapKTest related changes. This are the overall build times + time to execute MapKTest (from respective gradle build scan) https://github.com/arrow-kt/arrow/actions/runs/4511556481 iOS 41m 13s macOS 32m 47s Windows 28m 48s This are the times with the https://github.com/arrow-kt/arrow/actions/runs/4542439780 iOS 53m 18s macOS 45m 59s Windows 27m 41s As you can see the test times for On my machine i could see that running with the gradle This should explain the increase in duration as there are a bunch of new tests in To improve the situation i have arrow/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Generators.kt Line 235 in 8d002f6
These are the test times after the mentioned change https://github.com/arrow-kt/arrow/actions/runs/4545366194 iOS 43m 50s macOS 39m 33s Windows 25m 20s @serras do you think the increase in time is acceptable now? for reference this is the code snippet i used to measure the Arb
|
i tried out different types of maps (
So i have changed the code to use This further seems to improve the times: windows
macos
So i think i can remove the size limit again and we can go just with the change of types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job improving our tests, @abendt! Especially because now we know that properties are really covered by the data being produced.
I want to add that I'm impressed by the word you've put into this, involving several rounds of pushing to GitHub and looking at the results of the actions. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work @abendt 🙌 👏 🥳
This PR builds on #2980
there are a couple of MapK tests that test zipN with nullables. The tests construct the required testdata in the test body from the passed in arguments.
The PR #2980 has introduced an Arb that can be used to generate Maps that share a number of keys. However this Arb did not yet support null values.
In this PR the mentioned Arb is modified so it can also be used to generate Maps that have null values. This Arb is then used in the 'zipN with nullable' tests to replace the testdata setup in the test body.