When using `jdbc` driver for sqldelight in unit te...
# squarelibraries
u
When using
jdbc
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
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
Hmm tests are run in a separate process from gradle daemon?
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)?
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
blob smile 1
👍 1