driver for sqldelight in unit tests - do I need to close the driver on test teardown?
I currently do close it, but sometimes I see some cryptic errors about not being abke to open a database.
Simply not closing seems to help, but it feels wrong. Am I leaking something?
s
saket
04/19/2024, 11:50 PM
I don't think you need to worry about leaks because your process will be torn down anyway. however, one advantage for doing this is to ensure you aren't accidentally running database operations after a test has finished running, which may or may not be useful to you.
u
ursus
04/19/2024, 11:53 PM
Hmm tests are run in a separate process from gradle daemon?
ursus
04/19/2024, 11:55 PM
Have you seen some sporadic flaky errors when driver is closed?
I get som hprof dumps in my git index, with bunch of cryptic sigabrts or something like that
Then I rerun the test and it's fine 🤷♂️
Month a go I have removed driver closing and no more issues..so.. idk.. is there maybe a limit of how many database opens I can do (2000 tests)?
ursus
04/20/2024, 12:01 AM
Now that I think about your last part
It could just be, that some async stuff, writes to the in memory db, after the test got torn down hmm, nice idea I'll investigate